routine samemark

Documentation for routine samemark assembled from the following types:

class Str

From Str

(Str) routine samemark

multi sub samemark(Str:D $stringStr:D $pattern --> Str:D)
method    samemark(Str:D: Str:D $pattern --> Str:D)

Returns a copy of $string with the mark/accent information for each character changed such that it matches the mark/accent of the corresponding character in $pattern. If $string is longer than $pattern, the remaining characters in $string receive the same mark/accent as the last character in $pattern. If $pattern is empty no changes will be made.

Examples:

say 'åäö'.samemark('aäo');                        # OUTPUT: «aäo␤» 
say 'åäö'.samemark('a');                          # OUTPUT: «aao␤» 
 
say samemark('Pêrl''a');                        # OUTPUT: «Perl␤» 
say samemark('aöä''');                          # OUTPUT: «aöä␤»