Split a character string based on change of character: Difference between revisions
Split a character string based on change of character (view source)
Revision as of 01:30, 3 June 2017
, 7 years ago→{{header|Perl 6}}: Further exposition on multibyte character handling & some examples.
Walterpachl (talk | contribs) m (→{{header|REXX}}: add version 2) |
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: Further exposition on multibyte character handling & some examples.) |
||
Line 593:
# Testing:
for Q[gHHH5YY++///\], Q[fffn⃗n⃗n⃗»»»
put 'Original: ', $string;
put ' Split: ', group-chars($string).join(', ');
Line 602:
Original: gHHH5YY++///\
Split: g, HHH, 5, YY, ++, ///, \
Original: fffn⃗n⃗n⃗»»» ℵℵ☄☄☃☃̂☃🤔🇺🇸🤦♂️👨👩👧👦
Split: fff, , n⃗n⃗n⃗, »»», , ℵℵ, ☄☄, ☃, ☃̂, ☃,
</pre>
The second test-case is to show that Perl 6 works with strings on the Unicode grapheme level,
* {LATIN SMALL LETTER F} x 3
* {ZERO WIDTH NO-BREAK SPACE} x 3
Line 617:
* {SNOWMAN COMBINING CIRCUMFLEX ACCENT} x 1
* {SNOWMAN} x 1,
* {
* {REGIONAL INDICATOR SYMBOL LETTER U REGIONAL INDICATOR SYMBOL LETTER S} x 1
* {FACE PALM ZERO WIDTH JOINER MALE SIGN VARIATION SELECTOR-16} x 1
* {MAN ZERO WIDTH JOINER WOMAN ZERO WIDTH JOINER GIRL ZERO WIDTH JOINER BOY} x 1
=={{header|Phix}}==
|