-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
11 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -299,8 +299,8 @@ Text.find self pattern:(Regex | Text)=".*" case_sensitivity:Case_Sensitivity=..S | |
example_find_all_insensitive = | ||
## This matches `aABbbbc` @ character 0 and `aBC` @ character 11 | ||
"aABbbbccccaaBCaaaa".find_all "a[ab]+c" Case_Sensitivity.Insensitive | ||
Text.find_all : Text -> Case_Sensitivity -> Vector Match ! Regex_Syntax_Error | Illegal_Argument | ||
Text.find_all self pattern:Text=".*" case_sensitivity:Case_Sensitivity=..Sensitive = | ||
Text.find_all : Text|Regex -> Case_Sensitivity -> Vector Match ! Regex_Syntax_Error | Illegal_Argument | ||
Text.find_all self pattern:Text|Regex=".*" case_sensitivity:Case_Sensitivity=..Sensitive = | ||
case_insensitive = case_sensitivity.is_case_insensitive_in_memory | ||
compiled_pattern = Regex.compile pattern case_insensitive=case_insensitive | ||
compiled_pattern.match_all self | ||
|
@@ -334,8 +334,8 @@ Text.find_all self pattern:Text=".*" case_sensitivity:Case_Sensitivity=..Sensiti | |
regex = ".+ct@.+" | ||
# Evaluates to true | ||
"[email protected]".match regex Case_Sensitivity.Insensitive | ||
Text.match : Text -> Case_Sensitivity -> Boolean ! Regex_Syntax_Error | Illegal_Argument | ||
Text.match self pattern:Text=".*" case_sensitivity:Case_Sensitivity=..Sensitive = | ||
Text.match : Text|Regex -> Case_Sensitivity -> Boolean ! Regex_Syntax_Error | Illegal_Argument | ||
Text.match self pattern:Text|Regex=".*" case_sensitivity:Case_Sensitivity=..Sensitive = | ||
case_insensitive = case_sensitivity.is_case_insensitive_in_memory | ||
compiled_pattern = Regex.compile pattern case_insensitive=case_insensitive | ||
compiled_pattern.matches self | ||
|
@@ -452,8 +452,8 @@ Text.split self delimiter="," case_sensitivity:Case_Sensitivity=..Sensitive use_ | |
|
||
'Hello Big\r\nWide\tWorld\nGoodbye!' . tokenize "(\S+)(?:\s+|$)" | ||
== ["Hello","Big","Wide","World","Goodbye!"] | ||
Text.tokenize : Text -> Case_Sensitivity -> Vector Text | ||
Text.tokenize self pattern:Text=(Missing_Argument.throw "pattern") case_sensitivity:Case_Sensitivity=..Sensitive = | ||
Text.tokenize : Text|Regex -> Case_Sensitivity -> Vector Text | ||
Text.tokenize self pattern:Text|Regex=(Missing_Argument.throw "pattern") case_sensitivity:Case_Sensitivity=..Sensitive = | ||
case_insensitive = case_sensitivity.is_case_insensitive_in_memory | ||
compiled_pattern = Regex.compile pattern case_insensitive=case_insensitive | ||
compiled_pattern.tokenize self | ||
|
@@ -614,7 +614,7 @@ Cleansable_Text.from (that:Text) = Cleansable_Text.Value (pattern->replace_with- | |
|
||
"แมวมีสี่ขา".words == ['แมว', 'มี', 'สี่', 'ขา'] | ||
Text.words : Boolean -> Vector Text | ||
Text.words self (keep_whitespace : Boolean = False) = | ||
Text.words self keep_whitespace:Boolean=False = | ||
iterator = BreakIterator.getWordInstance | ||
iterator.setText self | ||
Vector.build builder-> | ||
|
@@ -657,7 +657,7 @@ Text.words self (keep_whitespace : Boolean = False) = | |
|
||
'\na\nb\n'.lines keep_endings=True == ['\n', 'a\n', 'b\n'] | ||
Text.lines : Boolean -> Vector Text | ||
Text.lines self (keep_endings : Boolean = False) = | ||
Text.lines self keep_endings:Boolean=False = | ||
Vector.from_polyglot_array (Text_Utils.split_on_lines self keep_endings) | ||
|
||
## GROUP Text | ||
|
@@ -684,7 +684,7 @@ Text.lines self (keep_endings : Boolean = False) = | |
"Hello World!".insert 5 " Cruel" == "Hello Cruel World!" | ||
"Hello World!".insert -1 " Cruel" == "Hello World! Cruel" | ||
Text.insert : Integer -> Text -> Text ! Index_Out_Of_Bounds | ||
Text.insert self (index : Integer) (that : Text) = | ||
Text.insert self index:Integer that:Text = | ||
len = self.length | ||
idx = if index < 0 then len + index + 1 else index | ||
if (idx < 0) || (idx > len) then Error.throw (Index_Out_Of_Bounds.Error index len) else | ||
|
@@ -718,7 +718,7 @@ Text.insert self (index : Integer) (that : Text) = | |
"A0".is_digit 1 == True | ||
"건반(Korean)".is_digit 1 == False | ||
Text.is_digit : Integer -> Boolean ! Index_Out_Of_Bounds | ||
Text.is_digit self (index=0) = | ||
Text.is_digit self index:Integer=0 = | ||
grapheme = self.at index | ||
char = (Text_Utils.get_chars grapheme).at 0 | ||
char>=48 && char<=57 | ||
|
@@ -1025,7 +1025,7 @@ Text.* self count:Integer = self.repeat count | |
|
||
"Hello ".repeat 2 == "Hello Hello " | ||
Text.repeat : Integer -> Text | ||
Text.repeat self (count : Integer = 1) = | ||
Text.repeat self count:Integer=1 = | ||
0.up_to count . fold "" acc-> _-> acc + self | ||
|
||
## ALIAS first, head, keep, last, left, limit, mid, right, slice, substring, tail, top | ||
|