From 44892df4c5686b292a058ca19eaba1e852fe42f3 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 6 Sep 2024 00:03:28 -0400 Subject: Add Text.trim() --- test/text.tm | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/text.tm') diff --git a/test/text.tm b/test/text.tm index 450d8ae9..c98ca1c6 100644 --- a/test/text.tm +++ b/test/text.tm @@ -257,6 +257,18 @@ func main(): >> "Abc":repeat(3) = "AbcAbcAbc" + >> " abc def ":trim() + = "abc def" + >> " abc123def ":trim($/{!digit}/) + = "123" + >> " abc123def ":trim($/{!digit}/, trim_left=no) + = " abc123" + >> " abc123def ":trim($/{!digit}/, trim_right=no) + = "123def " + # Only trim single whole matches that bookend the text: + >> "AbcAbcxxxxxxxxAbcAbc":trim($/Abc/) + = "AbcxxxxxxxxAbc" + do: !! Testing concatenation-stability: >> ab := Text.from_codepoint_names(["LATIN SMALL LETTER E", "COMBINING VERTICAL LINE BELOW"]) -- cgit v1.2.3