Split a character string based on change of character: Difference between revisions

m
→‎{{header|Perl 6}}: Further exposition on multibyte character handling & some examples.
m (→‎{{header|REXX}}: add version 2)
m (→‎{{header|Perl 6}}: Further exposition on multibyte character handling & some examples.)
Line 593:
# Testing:
 
for Q[gHHH5YY++///\], Q[fffn⃗n⃗n⃗»»» ℵℵ☄☄☃☃̂☃☄☄ℵℵ☄☄☃☃̂☃🤔🇺🇸🤦‍♂️👨‍👩‍👧‍👦] -> $string {
put 'Original: ', $string;
put ' Split: ', group-chars($string).join(', ');
Line 602:
Original: gHHH5YY++///\
Split: g, HHH, 5, YY, ++, ///, \
Original: fffn⃗n⃗n⃗»»» ℵℵ☄☄☃☃̂☃🤔🇺🇸🤦‍♂️👨‍👩‍👧‍👦
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, and handles combiners and zero width characters up to Unicode Version 9.0, and the newer multi byte emoji characters up to Version 4.0 correctly. (Perl 6 provisionally handles Unicode Versions 10 and Emoji Version 5.0 but they aren't released yet so aren't officially supported.) For those of you with crappy browsers, thatunable to display the second string, it consists of:
* {LATIN SMALL LETTER F} x 3
* {ZERO WIDTH NO-BREAK SPACE} x 3
Line 617:
* {SNOWMAN COMBINING CIRCUMFLEX ACCENT} x 1
* {SNOWMAN} x 1,
* {COMETTHINKING FACE} x 21
* {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}}==
10,333

edits