From 6d7e09bf1801c2fe183df17cc67017a6d3d8513b Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 2 Sep 2024 23:07:08 -0400 Subject: Add Text:split() and use that with an empty pattern instead of Text:clusters() --- test/text.tm | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/text.tm b/test/text.tm index dc342659..0955ffd2 100644 --- a/test/text.tm +++ b/test/text.tm @@ -20,7 +20,7 @@ func main(): = yes >> amelie := "Am$(\UE9)lie" - >> amelie:clusters() + >> amelie:split() = ["A", "m", "é", "l", "i", "e"] : [Text] >> amelie:utf32_codepoints() = [65_i32, 109_i32, 233_i32, 108_i32, 105_i32, 101_i32] : [Int32] @@ -28,7 +28,7 @@ func main(): = [65_i8, 109_i8, -61_i8, -87_i8, 108_i8, 105_i8, 101_i8] : [Int8] >> amelie2 := "Am$(\U65\U301)lie" - >> amelie2:clusters() + >> amelie2:split() = ["A", "m", "é", "l", "i", "e"] : [Text] >> amelie2:utf32_codepoints() = [65_i32, 109_i32, 233_i32, 108_i32, 105_i32, 101_i32] : [Int32] @@ -128,3 +128,15 @@ func main(): = ["one", "two", "three", ""] >> "one$(\r\n)two$(\r\n)three$(\r\n)":lines() = ["one", "two", "three"] + + >> "one two three":split(" ") + = ["one", "two", "three"] + + >> "one,two,three,":split(",") + = ["one", "two", "three", ""] + + >> "one two three":split("[..space]") + = ["one", "two", "three"] + + >> "abc":split("") + = ["a", "b", "c"] -- cgit v1.2.3