35 lines
1.1 KiB
Text
35 lines
1.1 KiB
Text
include "utf8pat.xin"
|
||
|
||
define stream function ucps (value stream chars) as
|
||
local integer num
|
||
local stream unicodes
|
||
open unicodes as buffer
|
||
repeat scan chars
|
||
match utf8-char => s-char
|
||
set num to utf8-char-number(s-char)
|
||
put unicodes 'U+%u16r4fzd(num) '
|
||
again
|
||
close unicodes
|
||
return unicodes
|
||
|
||
process
|
||
local stream s variable initial {'brooms', '𝓱𝓲𝓽', 'là'}
|
||
repeat over s
|
||
output '----------------------------------------------------------------%n'
|
||
output 'Word: %g(s)%n ' || ucps(s) || '%n'
|
||
do scan s
|
||
match utf8-char utf8-char+ => firstremoved
|
||
output 'First removed: %x(firstremoved)%n '
|
||
output ucps(firstremoved) || '%n'
|
||
done
|
||
do scan s
|
||
match ((lookahead not (utf8-char value-end)) any)+ => lastremoved
|
||
output 'Last removed: %x(lastremoved)%n '
|
||
output ucps(lastremoved) || '%n'
|
||
done
|
||
do scan s
|
||
match utf8-char ((lookahead not (utf8-char value-end)) any)+ => bothremoved
|
||
output 'Both removed: %x(bothremoved)%n '
|
||
output ucps(bothremoved) || '%n'
|
||
done
|
||
again
|