string-util
1 String Utilities
(require string-util) | package: string-util |
procedure
(null-string? s) → Boolean
s : String
Is the string the empty string?
procedure
(default-string s default) → String
s : String default : String
If given string s is the null-string? return the default String, otherwise the String s.
procedure
(starts-with-char? s ch) → Boolean
s : String ch : Char
Does the string start with the char.
procedure
(ends-with-char? s ch) → Boolean
s : String ch : Char
Does the string end with the char.
procedure
(starts-with? s prefix) → Boolean
s : String prefix : String
Does the string start with the given prefix.
procedure
(string-first-char-occurrence s ch) → (Option Index)
s : String ch : Char
Returns the index of the first occurrence of the character in the string scanning from left to right. Returns #f if the character is not found in the string.
procedure
(string-common-prefix-length s1 s2) → Index
s1 : String s2 : String
Given two strings returns the index of their longest common prefix from left to right. In other words, the first index position before the two strings start to diverge.
Returns the common prefix string from left to right between two strings.
procedure
(string-tokenize s delims) → (Listof String)
s : String delims : Char-Set
Split the string into tokens using the set of char delimiters.
procedure
(weave-string-separator sep lst) → String
sep : String lst : (Listof String)
Weave a the separator string between each string in the list and then reduce to a single string value.
For example:
(weave-string-separator "," '("1" "2" "3")) "1,2,3" (weave-string-separator "," '("1")) "1"
procedure
(substring-trim-spaces s start-pos end-pos) → String
s : String start-pos : Integer end-pos : Integer
Extracts a substring from the start index inclusive to the end index exclusive. Spaces are trimmed from both ends.