38 lines
1.6 KiB
Text
38 lines
1.6 KiB
Text
|
|
macro utf8-char is
|
|||
|
|
(["%16r{00}" to "%16r{7F}"] |
|
|||
|
|
["%16r{C0}" to "%16r{DF}"] ["%16r{80}" to "%16r{BF}"] |
|
|||
|
|
["%16r{E0}" to "%16r{EF}"] ["%16r{80}" to "%16r{BF}"] {2} |
|
|||
|
|
["%16r{F0}" to "%16r{F7}"] ["%16r{80}" to "%16r{BF}"] {3}) macro-end
|
|||
|
|
|
|||
|
|
process
|
|||
|
|
local stream s initial {'This 𝓲𝓼 the 𝓞𝓶𝓷𝓲𝓜𝓪𝓻𝓴 solution.'}
|
|||
|
|
using group StartingFrom_n_CharactersInAndOf_m_Length submit s
|
|||
|
|
using group StartingFrom_n_charactersInUpToTheEndOfTheString submit s
|
|||
|
|
using group WholeStringMinusTheLastCharacter submit s
|
|||
|
|
using group StartingFromKnownCharacterAndOf_m_Length submit s
|
|||
|
|
using group StartingFromKnownSubstringAndOf_m_Length submit s
|
|||
|
|
|
|||
|
|
group StartingFrom_n_CharactersInAndOf_m_Length
|
|||
|
|
find value-start utf8-char{12} utf8-char{8} => p
|
|||
|
|
output p || '%n' ; outputs characters 13 to 20: 𝓞𝓶𝓷𝓲𝓜𝓪𝓻𝓴
|
|||
|
|
|
|||
|
|
group StartingFrom_n_charactersInUpToTheEndOfTheString
|
|||
|
|
find value-start utf8-char{12} utf8-char+ => p
|
|||
|
|
output p || '%n' ; outputs characters 13 to last: 𝓞𝓶𝓷𝓲𝓜𝓪𝓻𝓴 solution.
|
|||
|
|
|
|||
|
|
group WholeStringMinusTheLastCharacter
|
|||
|
|
find value-start ((lookahead not (utf8-char value-end)) utf8-char)+ => p
|
|||
|
|
output p || '%n' ; outputs characters 1 to (last - 1), so without the .
|
|||
|
|
|
|||
|
|
group StartingFromKnownCharacterAndOf_m_Length
|
|||
|
|
find 'T' utf8-char{3} => p
|
|||
|
|
output p || '%n' ; outputs his following T
|
|||
|
|
|
|||
|
|
group StartingFromKnownSubstringAndOf_m_Length
|
|||
|
|
find '𝓞𝓶𝓷𝓲𝓜' utf8-char{3} => p
|
|||
|
|
output p || '%n' ; outputs 𝓪𝓻𝓴 following 𝓞𝓶𝓷𝓲𝓜
|
|||
|
|
|
|||
|
|
group #implied
|
|||
|
|
find utf8-char
|
|||
|
|
; ensures no other characters go to the output
|