Skip to content

Instantly share code, notes, and snippets.

@dogbert17
Last active July 13, 2016 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dogbert17/3224c4290a01b94a023e03175dfafabe to your computer and use it in GitHub Desktop.
Save dogbert17/3224c4290a01b94a023e03175dfafabe to your computer and use it in GitHub Desktop.
Attempt to document Str.samemark
=head2 routine samemark
multi sub samemark(Str:D $string, Str:D $pattern) returns Str:D
method samemark(Str:D: Str:D $pattern) returns Str:D
Returns a copy of C<$string> with the mark/accent information for each
character changed such that it matches the mark/accent of the corresponding
character in C<$pattern>. If C<$string> is longer than C<$pattern>, the
remaining characters in C<$string> receive the same mark/accent as the last
character in C<$pattern>. This means that C<$pattern> must contain at least
one character or an exception will be thrown.
Examples:
say 'åäö'.samemark('aäo'); # aäo
say 'åäö'.samemark('a'); # aao
say samemark('Pêrl', 'a'); # Perl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment