FSharpx.Extras


String

Namespace: FSharpx

Functional wrappers around String instance methods

Functions and values

Function or valueDescription
compare comparisonType strA strB
Signature: comparisonType:StringComparison -> strA:string -> strB:string -> int

Compares two specified String objects and returns an integer that indicates their relative position in the sort order.

compareIgnoreCase strA strB
Signature: strA:string -> strB:string -> int

Compares two specified String objects and returns an integer that indicates their relative position in the sort order. Compare strings using ordinal (binary) sort rules and ignoring the case of the strings being compared.

contains value s
Signature: value:string -> s:string -> bool

Returns a value indicating whether a specified substring occurs within this string.

endsWith value s
Signature: value:string -> s:string -> bool

Determines whether the end of this string instance matches the specified string.

endsWith' value ignoreCase culture s
Signature: value:string -> ignoreCase:bool -> culture:CultureInfo -> s:string -> bool

Determines whether the end of this string instance matches the specified string when compared using the specified culture.

endsWith'' value comparisonType s
Signature: value:string -> comparisonType:StringComparison -> s:string -> bool

Determines whether the end of this string instance matches the specified string when compared using the specified comparison option.

equals comparisonType a b
Signature: comparisonType:StringComparison -> a:string -> b:string -> bool

Determines whether two specified String objects have the same value.

equalsIgnoreCase a b
Signature: a:string -> b:string -> bool

Determines whether two specified String objects have the same value. Compare strings using ordinal (binary) sort rules and ignoring the case of the strings being compared.

indexOfAny anyOf s
Signature: anyOf:char [] -> s:string -> int

Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters.

indexOfAny' anyOf startIndex s
Signature: anyOf:char [] -> startIndex:int -> s:string -> int

Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters. The search starts at a specified character position.

indexOfAny'' anyOf startIndex count s
Signature: anyOf:char [] -> startIndex:int -> count:int -> s:string -> int

Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters. The search starts at a specified character position and examines a specified number of character positions.

indexOfChar value s
Signature: value:char -> s:string -> int

Reports the zero-based index of the first occurrence of the specified Unicode character in this string.

indexOfChar' value startIndex s
Signature: value:char -> startIndex:int -> s:string -> int

Reports the zero-based index of the first occurrence of the specified Unicode character in this string. The search starts at a specified character position.

indexOfChar'' value startIndex count s
Signature: value:char -> startIndex:int -> count:int -> s:string -> int

Reports the zero-based index of the first occurrence of the specified character in this instance. The search starts at a specified character position and examines a specified number of character positions.

indexOfString value s
Signature: value:string -> s:string -> int

Reports the zero-based index of the first occurrence of the specified string in this instance.

indexOfString' value startIndex s
Signature: value:string -> startIndex:int -> s:string -> int

Reports the zero-based index of the first occurrence of the specified string in this instance. The search starts at a specified character position.

indexOfString'' value startIndex count s
Signature: value:string -> startIndex:int -> count:int -> s:string -> int

Reports the zero-based index of the first occurrence of the specified string in this instance. The search starts at a specified character position and examines a specified number of character positions.

indexOfStringWithComparison (...)
Signature: value:string -> comparisonType:StringComparison -> s:string -> int

Reports the zero-based index of the first occurrence of the specified string in the current String object. A parameter specifies the type of search to use for the specified string.

indexOfStringWithComparison' (...)
Signature: value:string -> startIndex:int -> comparisonType:StringComparison -> s:string -> int

Reports the zero-based index of the first occurrence of the specified string in the current String object. Parameters specify the starting search position in the current string and the type of search to use for the specified string.

indexOfStringWithComparison'' (...)
Signature: value:string -> startIndex:int -> count:int -> comparisonType:StringComparison -> s:string -> int

Reports the zero-based index of the first occurrence of the specified string in the current String object. Parameters specify the starting search position in the current string, the number of characters in the current string to search, and the type of search to use for the specified string.

insert startIndex value s
Signature: startIndex:int -> value:string -> s:string -> string

Returns a new string in which a specified string is inserted at a specified index position in this instance.

isNormalized s
Signature: s:string -> bool

Indicates whether this string is in Unicode normalization form C.

isNormalized' normalizationForm s
Signature: normalizationForm:NormalizationForm -> s:string -> bool

Indicates whether this string is in the specified Unicode normalization form.

lastIndexOfChar value s
Signature: value:char -> s:string -> int

Reports the zero-based index position of the last occurrence of a specified Unicode character within this instance.

lastIndexOfChar' value startIndex s
Signature: value:char -> startIndex:int -> s:string -> int

Reports the zero-based index position of the last occurrence of a specified Unicode character within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string.

lastIndexOfChar'' (...)
Signature: value:char -> startIndex:int -> count:int -> s:string -> int

Reports the zero-based index position of the last occurrence of the specified Unicode character in a substring within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string for a specified number of character positions.

lastIndexOfString value s
Signature: value:string -> s:string -> int

Reports the zero-based index position of the last occurrence of a specified string within this instance.

lastIndexOfString' value startIndex s
Signature: value:string -> startIndex:int -> s:string -> int

Reports the zero-based index position of the last occurrence of a specified string within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string.

lastIndexOfString'' (...)
Signature: value:string -> startIndex:int -> count:int -> s:string -> int

Reports the zero-based index position of the last occurrence of a specified string within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string for a specified number of character positions.

lastIndexOfStringWithComparison (...)
Signature: value:string -> comparisonType:StringComparison -> s:string -> int

Reports the zero-based index of the last occurrence of a specified string within the current String object. A parameter specifies the type of search to use for the specified string.

lastIndexOfStringWithComparison' (...)
Signature: value:string -> startIndex:int -> comparisonType:StringComparison -> s:string -> int

Reports the zero-based index of the last occurrence of a specified string within the current String object. The search starts at a specified character position and proceeds backward toward the beginning of the string. A parameter specifies the type of comparison to perform when searching for the specified string.

lastIndexOfStringWithComparison'' (...)
Signature: value:string -> startIndex:int -> count:int -> comparisonType:StringComparison -> s:string -> int

Reports the zero-based index position of the last occurrence of a specified string within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string for the specified number of character positions. A parameter specifies the type of comparison to perform when searching for the specified string.

normalize s
Signature: s:string -> string

Returns a new string whose textual value is the same as this string, but whose binary representation is in Unicode normalization form C.

normalize' normalizationForm s
Signature: normalizationForm:NormalizationForm -> s:string -> string

Returns a new string whose textual value is the same as this string, but whose binary representation is in the specified Unicode normalization form.

padLeft totalWidth s
Signature: totalWidth:int -> s:string -> string

Returns a new string that right-aligns the characters in this instance by padding them with spaces on the left, for a specified total length.

padLeft' totalWidth paddingChar s
Signature: totalWidth:int -> paddingChar:char -> s:string -> string

Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified Unicode character, for a specified total length.

padRight totalWidth s
Signature: totalWidth:int -> s:string -> string

Returns a new string that left-aligns the characters in this string by padding them with spaces on the right, for a specified total length.

padRight' totalWidth paddingChar s
Signature: totalWidth:int -> paddingChar:char -> s:string -> string

Returns a new string that left-aligns the characters in this string by padding them on the right with a specified Unicode character, for a specified total length.

remove startIndex s
Signature: startIndex:int -> s:string -> string

Returns a new string in which all the characters in the current instance, beginning at a specified position and continuing through the last position, have been deleted.

remove' startIndex count s
Signature: startIndex:int -> count:int -> s:string -> string

Returns a new string in which a specified number of characters in the current instance beginning at a specified position have been deleted.

replace oldChar newChar s
Signature: oldChar:char -> newChar:char -> s:string -> string

Returns a new string in which all occurrences of a specified Unicode character in this instance are replaced with another specified Unicode character.

replace' oldValue newValue s
Signature: oldValue:string -> newValue:string -> s:string -> string

Returns a new string in which all occurrences of a specified string in the current instance are replaced with another specified string.

splitChar separator s
Signature: separator:char [] -> s:string -> string []

Splits a string into substrings that are based on the characters in an array.

splitChar' separator count s
Signature: separator:char [] -> count:int -> s:string -> string []

Splits a string into a maximum number of substrings based on the characters in an array. You also specify the maximum number of substrings to return.

splitCharWithOptions separator options s
Signature: separator:char [] -> options:StringSplitOptions -> s:string -> string []

Splits a string into substrings based on the characters in an array. You can specify whether the substrings include empty array elements.

splitCharWithOptions' (...)
Signature: separator:char [] -> count:int -> options:StringSplitOptions -> s:string -> string []

Splits a string into a maximum number of substrings based on the characters in an array.

splitString separator options s
Signature: separator:string [] -> options:StringSplitOptions -> s:string -> string []

Splits a string into substrings based on the strings in an array. You can specify whether the substrings include empty array elements.

splitString' separator count options s
Signature: separator:string [] -> count:int -> options:StringSplitOptions -> s:string -> string []

Splits a string into a maximum number of substrings based on the strings in an array. You can specify whether the substrings include empty array elements.

startsWith value s
Signature: value:string -> s:string -> bool

Determines whether the beginning of this string instance matches the specified string.

startsWith' value comparisonType s
Signature: value:string -> comparisonType:StringComparison -> s:string -> bool

Determines whether the beginning of this string instance matches the specified string when compared using the specified comparison option.

startsWith'' value ignoreCase culture s
Signature: value:string -> ignoreCase:bool -> culture:CultureInfo -> s:string -> bool

Determines whether the beginning of this string instance matches the specified string when compared using the specified culture.

substring startIndex s
Signature: startIndex:int -> s:string -> string

Retrieves a substring from this instance. The substring starts at a specified character position and continues to the end of the string.

substring' startIndex length s
Signature: startIndex:int -> length:int -> s:string -> string

Retrieves a substring from this instance. The substring starts at a specified character position and has a specified length.

toCharArray s
Signature: s:string -> char []

Copies the characters in this instance to a Unicode character array.

toCharArray' startIndex length s
Signature: startIndex:int -> length:int -> s:string -> char []

Copies the characters in a specified substring in this instance to a Unicode character array.

toLower s
Signature: s:string -> string

Returns a copy of this string converted to lowercase.

toLower' culture s
Signature: culture:CultureInfo -> s:string -> string

Returns a copy of this string converted to lowercase, using the casing rules of the specified culture.

toLowerInvariant s
Signature: s:string -> string

Returns a copy of this String object converted to lowercase using the casing rules of the invariant culture.

toUpper s
Signature: s:string -> string

Returns a copy of this string converted to uppercase.

toUpper' culture s
Signature: culture:CultureInfo -> s:string -> string

Returns a copy of this string converted to uppercase, using the casing rules of the specified culture.

toUpperInvariant s
Signature: s:string -> string

Returns a copy of this String object converted to uppercase using the casing rules of the invariant culture.

trim s
Signature: s:string -> string

Removes all leading and trailing white-space characters from the current String object.

trim' trimChars s
Signature: trimChars:char [] -> s:string -> string

Removes all leading and trailing occurrences of a set of characters specified in an array from the current String object.

trimEnd trimChars s
Signature: trimChars:char [] -> s:string -> string

Removes all trailing occurrences of a set of characters specified in an array from the current String object.

trimStart trimChars s
Signature: trimChars:char [] -> s:string -> string

Removes all leading occurrences of a set of characters specified in an array from the current String object.

Fork me on GitHub