String Module
Trims, splits, compares, replaces and cleans up text. Most functions return an empty string or a default value for a null string.
Functions and values
| Function or value |
Description
|
Full Usage:
String.apply f s
Parameters:
string -> 'a
s : string
Returns: 'a
Type parameters: 'a |
Apply f to string s
|
Full Usage:
String.arrayConcat cs
Parameters:
char[]
Returns: string
|
Concatenate an array of chars to a string Example: [|'a'; 'b'; 'c'|] |> arrayConcat yields "abc"
|
Full Usage:
String.capitalize s
Parameters:
string
Returns: string
|
Make the first character upper and the rest lower of a string
|
Full Usage:
String.contains
Returns: string -> string -> bool
|
Check if string s2 contains string s1
|
Full Usage:
String.containsCapsInsens s2 s1
Parameters:
string
s1 : string
Returns: bool
|
Check if string s1 contains s2 caps insensitive
|
Full Usage:
String.countChar c t
Parameters:
string
t : string
Returns: int
|
Count the number of times character c appears in string t
|
Full Usage:
String.countFirstChar c t
Parameters:
char
t : string
Returns: int
|
Count the number of times that a string t starts with character c
|
Full Usage:
String.equals s1 s2
Parameters:
'a
s2 : 'a
Returns: bool
Type parameters: 'a (requires equality) |
Check if string s1 equals s2
|
Full Usage:
String.equalsCapInsens s1 s2
Parameters:
string
s2 : string
Returns: bool
|
Check if string s1 equals s2 caps insensitive
|
Full Usage:
String.firstStringChar
Returns: string -> string
|
Get the first character of a string as a string
|
Full Usage:
String.firstToUpper
Returns: string -> string
|
Make the first char of a string upper case
|
Full Usage:
String.get
Returns: string -> string
|
Utility to enable type inference
|
Full Usage:
String.isLetter s
Parameters:
string
Returns: bool
|
Check if a string is a letter
|
Full Usage:
String.isNullOrEmpty value
Parameters:
string
Returns: bool
|
True when s is null or zero-length. White space counts as content here, unlike isNullOrWhiteSpace.
|
Full Usage:
String.isNullOrWhiteSpace value
Parameters:
string
Returns: bool
|
True when s is null, empty, or only white space.
|
Full Usage:
String.length
Returns: string -> int
|
Get the length of s
|
Full Usage:
String.letters
Returns: string list
|
Get all letters as a string list
|
Full Usage:
String.normaliseWhiteSpaceLower s
Parameters:
string
Returns: string
|
Trim, collapse internal whitespace (tabs/newlines included), lowercase. Tab is the key separator, so it must not survive inside a field.
|
Full Usage:
String.notEmpty
Returns: string -> bool
|
True when s has content other than white space. The negation of isNullOrWhiteSpace; a null string is not "not empty".
|
Full Usage:
String.notNullOrEmpty
Returns: string -> bool
|
True when s has at least one character, white space included.
|
|
|
Full Usage:
String.regexReplace regS replS s
Parameters:
string
replS : string
s : string
Returns: string
|
Replace a regular expression in a string Example: regexReplace @"[\d-]" "" "abc123" |> equals "abc"
|
Full Usage:
String.remove n s
Parameters:
int
s : string
Returns: string
|
Removes the last 'n' characters from the input string 's'. If the resulting string length is less than 0, an empty string is returned. Parameters: - n: Number of characters to remove from the end of the string. - s: Input string. Returns: - Modified string with the last 'n' characters removed.
|
|
|
Full Usage:
String.removeExtraSpaces input
Parameters:
string
Returns: string
|
|
Full Usage:
String.removeTextBetween start stop text
Parameters:
string
stop : string
text : string
Returns: string
|
Removes all characters from a string between start and stop
|
Full Usage:
String.removeTextBetweenBrackets
Returns: string -> string
|
Remove all text between brackets
|
|
|
Full Usage:
String.removeTrailingZerosFromDutchNumber s
Parameters:
string
Returns: string
|
Remove trailing zeros from a Dutch number
|
Full Usage:
String.replace
Returns: string -> string -> string -> string
|
Replace os with ns in string s.
|
Full Usage:
String.replaceNumbers
Returns: string -> string -> string
|
Replace all numbers in a string Example: replaceNumbers "123" "a" |> equals "a"
|
Full Usage:
String.restString s
Parameters:
string
Returns: string
|
Return the rest of a string as a string
|
Full Usage:
String.sha1Short fields
Parameters:
string list
Returns: string
|
Hash a key field list to a 12-char lowercase hex
|
Full Usage:
String.split dels s
Parameters:
string
s : string
Returns: string list
|
Split a string s at string dels
|
Full Usage:
String.splitAt c s
Parameters:
char
s : string
Returns: string[]
|
Split string s at character c
|
Full Usage:
String.startsWith
Returns: string -> string -> bool
|
Check whether s1 starts with s2 caps sensitive
|
Full Usage:
String.startsWithCapsInsensitive
Returns: string -> string -> bool
|
Check whether s1 starts with s2 caps insensitive
|
Full Usage:
String.startsWithEqs eqs s2 s1
Parameters:
string -> string -> bool
s2 : string
s1 : string
Returns: bool
|
Check whether s1 starts with s2 using string comparison eqs
|
Full Usage:
String.subString start length
Parameters:
int
length : int
Returns: string -> string
|
Get a substring starting at start with length length
|
Full Usage:
String.toLower
Returns: string -> string
|
Make string all lower chars
|
Full Usage:
String.toString o
Parameters:
'a
Returns: string
Type parameters: 'a |
Convert object to string
|
Full Usage:
String.toUpper
Returns: string -> string
|
Make string all upper chars
|
Full Usage:
String.trim
Returns: string -> string
|
Trim string s
|
GenPRES