8.18
top
← prev up next →

string-utilπŸ”— i

Raymond Racine <ray.racine@gmail.com>

1String UtilitiesπŸ”— i

procedure

( null-string? s)Boolean

s:String
(String->Boolean)

Is the string the empty string?

procedure

( default-string sdefault)String

s:String
default:String
(->StringStringString)

If given string s is the null-string? return the default String, otherwise the String s.

procedure

( starts-with-char? sch)Boolean

s:String
ch:Char
(StringChar->Boolean)

Does the string start with the char.

procedure

( ends-with-char? sch)Boolean

s:String
ch:Char
(StringChar->Boolean)

Does the string end with the char.

procedure

( starts-with? sprefix)Boolean

s:String
prefix:String
(StringString->Boolean)

Does the string start with the given prefix.

procedure

( string-first-char-occurrence sch)(OptionIndex)

s:String
ch:Char
(StringChar->(OptionIndex))

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 s1s2)Index

s1:String
s2:String
(StringString->Index)

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.

procedure

( substring-common-prefixs1s2)String

s1:String
s2:String
(StringString->String)

Returns the common prefix string from left to right between two strings.

procedure

( string-tokenize sdelims)(ListofString)

s:String
delims:Char-Set
(StringChar-Set->(ListofString))

Split the string into tokens using the set of char delimiters.

procedure

( weave-string-separator seplst)String

sep:String
lst:(ListofString)
(String(ListofString)->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"
"1"

procedure

( substring-trim-spaces sstart-posend-pos)String

s:String
start-pos:Integer
end-pos:Integer
(:substring-trim-spaces (StringIntegerInteger->String))

Extracts a substring from the start index inclusive to the end index exclusive. Spaces are trimmed from both ends.

top
← prev up next →

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /