Course of Raku / Advanced / More about built-in types / Strings / Exercises / The domain part
Solution: The domain part
Here is a possible solution to the task.
Code
my $email = 'user@example.com';
my $at = $email.index('@');
say $email.substr($at + 1);🦋 You can find the source code in the file find-domain.raku.
Output
example.comComments
index('@')returns4— the zero-based position of the@sign.substr($at + 1)starts one character past the@and, with no length given, runs to the end of the string, yieldingexample.com.