Header menu logo Str

Str Type

The main module with functions for transforming strings.

It is implemented as a static class with only static methods. This is not a module so that only the namespace gets opened with open Str and not the module of the same name.

Static members

Static member Description

Str.addPrefix prefix txt

Full Usage: Str.addPrefix prefix txt

Parameters:
    prefix : string
    txt : string

Returns: string

Add a prefix to string

prefix : string
txt : string
Returns: string

Str.addSuffix suffix txt

Full Usage: Str.addSuffix suffix txt

Parameters:
    suffix : string
    txt : string

Returns: string

Add a suffix to string

suffix : string
txt : string
Returns: string

Str.after splitter stringToSearchIn

Full Usage: Str.after splitter stringToSearchIn

Parameters:
    splitter : string
    stringToSearchIn : string

Returns: string

Returns everything after first occurrence of a given splitting string. Or fails if splitter is not found. Uses StringComparison.Ordinal

splitter : string
stringToSearchIn : string
Returns: string

Str.afterChar splitter stringToSearchIn

Full Usage: Str.afterChar splitter stringToSearchIn

Parameters:
    splitter : char
    stringToSearchIn : string

Returns: string

Returns everything after first occurrence of a given splitting character. Or fails if splitter is not found

splitter : char
stringToSearchIn : string
Returns: string

Str.afterCharOrInput splitter stringToSearchIn

Full Usage: Str.afterCharOrInput splitter stringToSearchIn

Parameters:
    splitter : char
    stringToSearchIn : string

Returns: string

Returns everything after first occurrence of a given splitting character. Or full input string if splitter is not found

splitter : char
stringToSearchIn : string
Returns: string

Str.afterOrInput splitter stringToSearchIn

Full Usage: Str.afterOrInput splitter stringToSearchIn

Parameters:
    splitter : string
    stringToSearchIn : string

Returns: string

Returns everything after first occurrence of a given splitting string. Or full input string if splitter is not found. Uses StringComparison.Ordinal

splitter : string
stringToSearchIn : string
Returns: string

Str.before splitter stringToSearchIn

Full Usage: Str.before splitter stringToSearchIn

Parameters:
    splitter : string
    stringToSearchIn : string

Returns: string

Returns everything before first occurrence of a given splitting string. Or fails if splitter is not found. Uses StringComparison.Ordinal

splitter : string
stringToSearchIn : string
Returns: string

Str.beforeChar splitter stringToSearchIn

Full Usage: Str.beforeChar splitter stringToSearchIn

Parameters:
    splitter : char
    stringToSearchIn : string

Returns: string

Returns everything before first occurrence of a given splitting character. Or fails if splitter is not found.

splitter : char
stringToSearchIn : string
Returns: string

Str.beforeCharOrInput splitter stringToSearchIn

Full Usage: Str.beforeCharOrInput splitter stringToSearchIn

Parameters:
    splitter : char
    stringToSearchIn : string

Returns: string

Returns everything before first occurrence of a given splitting character. Or full input string if splitter is not found.

splitter : char
stringToSearchIn : string
Returns: string

Str.beforeOrInput splitter stringToSearchIn

Full Usage: Str.beforeOrInput splitter stringToSearchIn

Parameters:
    splitter : string
    stringToSearchIn : string

Returns: string

Returns everything before first occurrence of a given splitting string. Or full input string if splitter is not found. Uses StringComparison.Ordinal

splitter : string
stringToSearchIn : string
Returns: string

Str.between firstSplitter secondSplitter stringToSplit

Full Usage: Str.between firstSplitter secondSplitter stringToSplit

Parameters:
    firstSplitter : string
    secondSplitter : string
    stringToSplit : string

Returns: string

Finds text between two strings e.g.: between "X" "T" "cXabTk" = "ab" Fails if not both splitters are found. Delimiters are excluded in the returned strings

firstSplitter : string
secondSplitter : string
stringToSplit : string
Returns: string

Str.betweenChars firstSplitter secondSplitter stringToSplit

Full Usage: Str.betweenChars firstSplitter secondSplitter stringToSplit

Parameters:
    firstSplitter : Char
    secondSplitter : Char
    stringToSplit : string

Returns: string

Finds text between two Characters e.g.: between 'X' 'T' "cXabTk" = "ab" Fails if not both splitters are found. Delimiters are excluded in the returned strings

firstSplitter : Char
secondSplitter : Char
stringToSplit : string
Returns: string

Str.betweenCharsOrInput firstSplitter secondSplitter stringToSplit

Full Usage: Str.betweenCharsOrInput firstSplitter secondSplitter stringToSplit

Parameters:
    firstSplitter : Char
    secondSplitter : Char
    stringToSplit : string

Returns: string

Finds text between two Characters e.g.: between 'X' 'T' "cXabTk" = "ab" Returns full input string if not both splitters are found. Delimiters are excluded in the returned strings

firstSplitter : Char
secondSplitter : Char
stringToSplit : string
Returns: string

Str.betweenOrInput firstSplitter secondSplitter stringToSplit

Full Usage: Str.betweenOrInput firstSplitter secondSplitter stringToSplit

Parameters:
    firstSplitter : string
    secondSplitter : string
    stringToSplit : string

Returns: string

Finds text between two strings e.g.: between "X" "T" "cXabTk" = "ab" Returns full input string if not both splitters are found. Delimiters are excluded in the returned strings

firstSplitter : string
secondSplitter : string
stringToSplit : string
Returns: string

Str.compare strA strB

Full Usage: Str.compare strA strB

Parameters:
    strA : string
    strB : string

Returns: int

Compares two specified String objects and returns an integer that indicates their relative position in the sort order, u Uses StringComparison.Ordinal.

strA : string
strB : string
Returns: int

Str.compareIgnoreCase strA strB

Full Usage: Str.compareIgnoreCase strA strB

Parameters:
    strA : string
    strB : string

Returns: int

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

strA : string
strB : string
Returns: int

Str.concat separator lines

Full Usage: Str.concat separator lines

Parameters:
    separator : string
    lines : string seq

Returns: string
Modifiers: inline

Concatenates string with given separator Same as FSharp.Core.String.concat

separator : string
lines : string seq
Returns: string

Str.concatLines lines

Full Usage: Str.concatLines lines

Parameters:
    lines : string seq

Returns: string
Modifiers: inline

Concatenates string with Environment.NewLine

lines : string seq
Returns: string

Str.contains stringToFind stringToSearchIn

Full Usage: Str.contains stringToFind stringToSearchIn

Parameters:
    stringToFind : string
    stringToSearchIn : string

Returns: bool

Returns true if a specified substring occurs within this string.

stringToFind : string
stringToSearchIn : string
Returns: bool

Str.containsChar charToFind stringToSearchIn

Full Usage: Str.containsChar charToFind stringToSearchIn

Parameters:
    charToFind : char
    stringToSearchIn : string

Returns: bool

Returns true if specified character occurs within this string.

charToFind : char
stringToSearchIn : string
Returns: bool

Str.containsIgnoreCase stringToFind stringToSearchIn

Full Usage: Str.containsIgnoreCase stringToFind stringToSearchIn

Parameters:
    stringToFind : string
    stringToSearchIn : string

Returns: bool

Returns true if a specified substring occurs within this string ignoring casing. uses: stringToSearchIn.IndexOf(stringToFind, StringComparison.OrdinalIgnoreCase) <> -1

stringToFind : string
stringToSearchIn : string
Returns: bool

Str.countChar chr textToSearch

Full Usage: Str.countChar chr textToSearch

Parameters:
    chr : char
    textToSearch : string

Returns: int

Counts how often a character appears in a string

chr : char
textToSearch : string
Returns: int

Str.countSubString subString textToSearch

Full Usage: Str.countSubString subString textToSearch

Parameters:
    subString : string
    textToSearch : string

Returns: int

Counts how often a substring appears in a string Uses StringComparison.Ordinal

subString : string
textToSearch : string
Returns: int

Str.delete textToRemove fromString

Full Usage: Str.delete textToRemove fromString

Parameters:
    textToRemove : string
    fromString : string

Returns: string

Removes all occurrences of a substring from a string if it exists. same as: (Will return the same string instance, if text to remove is not found) Code:fromString.Replace(textToRemove, "")

textToRemove : string
fromString : string
Returns: string

Str.deleteChar charToRemove fromString

Full Usage: Str.deleteChar charToRemove fromString

Parameters:
    charToRemove : char
    fromString : string

Returns: string

Removes character from a string if it exists. same as: (Will return the same string instance, if char to remove is not found) Code: fromString.Replace(charToRemove.ToString(), "")

charToRemove : char
fromString : string
Returns: string

Str.endsWith stringToFindAtEnd stringSearchInAtEnd

Full Usage: Str.endsWith stringToFindAtEnd stringSearchInAtEnd

Parameters:
    stringToFindAtEnd : string
    stringSearchInAtEnd : string

Returns: bool

Determines whether the end of this string instance matches the specified string, using StringComparison.Ordinal.

stringToFindAtEnd : string
stringSearchInAtEnd : string
Returns: bool

Str.endsWithIgnoreCase stringToFindAtEnd stringSearchInAtEnd

Full Usage: Str.endsWithIgnoreCase stringToFindAtEnd stringSearchInAtEnd

Parameters:
    stringToFindAtEnd : string
    stringSearchInAtEnd : string

Returns: bool

Determines whether the end of this string instance matches the specified string, using StringComparison.OrdinalIgnoreCase.

stringToFindAtEnd : string
stringSearchInAtEnd : string
Returns: bool

Str.equals strA strB

Full Usage: Str.equals strA strB

Parameters:
    strA : string
    strB : string

Returns: bool

Determines whether two specified String objects have the same value, using StringComparison.Ordinal.(=fastest comparison)

strA : string
strB : string
Returns: bool

Str.equalsIgnoreCase strA strB

Full Usage: Str.equalsIgnoreCase strA strB

Parameters:
    strA : string
    strB : string

Returns: bool

Determines whether two specified String objects have the same value, using StringComparison.OrdinalIgnoreCase.

strA : string
strB : string
Returns: bool

Str.formatInOneLine s

Full Usage: Str.formatInOneLine s

Parameters:
    s : string

Returns: string

Joins string into one line. Replaces line break with a space character. Skips leading whitespace on each line. Joins multiple whitespaces into one. If string is null returns *null string* Does not include surrounding quotes.

s : string
Returns: string

Str.formatTruncated maxCharCount s

Full Usage: Str.formatTruncated maxCharCount s

Parameters:
    maxCharCount : int
    s : string

Returns: string

Reduces a string length for display to a maximum Length. Shows (..) as placeholder for skipped characters if string is longer than maxCharCount. If maxChars is bigger than 35 the placeholder will include the count of skipped characters: e.g. ( ... and 123 more chars.). maxCharCount will be set to be minimum 6. Returned strings are enclosed in quotation marks: '"'. If input is null it returns *null string*

maxCharCount : int
s : string
Returns: string

Str.formatTruncatedToMaxLines maxLineCount s

Full Usage: Str.formatTruncatedToMaxLines maxLineCount s

Parameters:
    maxLineCount : int
    s : string

Returns: string

Adds a note about trimmed line count if there are more ( ... and %d more lines.). Returned strings are enclosed in quotation marks: '"'. If string is null returns *null string*.

maxLineCount : int
s : string
Returns: string

Str.get str index

Full Usage: Str.get str index

Parameters:
    str : string - The input string.
    index : int - The input index.

Returns: char The value of the string at the given index.
Modifiers: inline

Gets an element from an string. (Use string.getNeg(i) function if you want to use negative indices too.)

str : string

The input string.

index : int

The input index.

Returns: char

The value of the string at the given index.

ArgumentOutOfRangeException Thrown when the index is negative or the input string does not contain enough elements.

Str.inQuotes txt

Full Usage: Str.inQuotes txt

Parameters:
    txt : string

Returns: string

Add a double quote (") at start and end.

txt : string
Returns: string

Str.inSingleQuotes txt

Full Usage: Str.inSingleQuotes txt

Parameters:
    txt : string

Returns: string

Add a single quote (') at start and end.

txt : string
Returns: string

Str.indexOfAny anyOf stringToSearchIn

Full Usage: Str.indexOfAny anyOf stringToSearchIn

Parameters:
    anyOf : char[]
    stringToSearchIn : string

Returns: int

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

anyOf : char[]
stringToSearchIn : string
Returns: int

Str.indexOfAnyFrom anyOf startIndex stringToSearchIn

Full Usage: Str.indexOfAnyFrom anyOf startIndex stringToSearchIn

Parameters:
    anyOf : char[]
    startIndex : int
    stringToSearchIn : string

Returns: 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.

anyOf : char[]
startIndex : int
stringToSearchIn : string
Returns: int

Str.indexOfAnyFromFor anyOf startIndex count stringToSearchIn

Full Usage: Str.indexOfAnyFromFor anyOf startIndex count stringToSearchIn

Parameters:
    anyOf : char[]
    startIndex : int
    count : int
    stringToSearchIn : string

Returns: 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.

anyOf : char[]
startIndex : int
count : int
stringToSearchIn : string
Returns: int

Str.indexOfChar charToFind stringToSearchIn

Full Usage: Str.indexOfChar charToFind stringToSearchIn

Parameters:
    charToFind : char
    stringToSearchIn : string

Returns: int

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

charToFind : char
stringToSearchIn : string
Returns: int

Str.indexOfCharFrom charToFind startIndex stringToSearchIn

Full Usage: Str.indexOfCharFrom charToFind startIndex stringToSearchIn

Parameters:
    charToFind : char
    startIndex : int
    stringToSearchIn : string

Returns: 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.

charToFind : char
startIndex : int
stringToSearchIn : string
Returns: int

Str.indexOfCharFromFor charToFind startIndex count stringToSearchIn

Full Usage: Str.indexOfCharFromFor charToFind startIndex count stringToSearchIn

Parameters:
    charToFind : char
    startIndex : int
    count : int
    stringToSearchIn : string

Returns: 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. When used in Fable this use the Knuth-Morris-Pratt algorithm via Str.indicesOf

charToFind : char
startIndex : int
count : int
stringToSearchIn : string
Returns: int

Str.indexOfString stringToFind stringToSearchIn

Full Usage: Str.indexOfString stringToFind stringToSearchIn

Parameters:
    stringToFind : string
    stringToSearchIn : string

Returns: int

Reports the zero-based index of the first occurrence of the specified string in this instance, using StringComparison.Ordinal.

stringToFind : string
stringToSearchIn : string
Returns: int

Str.indexOfStringFrom stringToFind startIndex stringToSearchIn

Full Usage: Str.indexOfStringFrom stringToFind startIndex stringToSearchIn

Parameters:
    stringToFind : string
    startIndex : int
    stringToSearchIn : string

Returns: 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, using StringComparison.Ordinal.

stringToFind : string
startIndex : int
stringToSearchIn : string
Returns: int

Str.indexOfStringFromFor stringToFind startIndex count stringToSearchIn

Full Usage: Str.indexOfStringFromFor stringToFind startIndex count stringToSearchIn

Parameters:
    stringToFind : string
    startIndex : int
    count : int
    stringToSearchIn : string

Returns: 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, using StringComparison.Ordinal. When used in Fable this use the Knuth-Morris-Pratt algorithm via Str.indicesOf

stringToFind : string
startIndex : int
count : int
stringToSearchIn : string
Returns: int

Str.indicesOf (text, pattern, searchFromIdx, searchLength, findNoMoreThan)

Full Usage: Str.indicesOf (text, pattern, searchFromIdx, searchLength, findNoMoreThan)

Parameters:
    text : string - The text to search in
    pattern : string - The pattern to search for
    searchFromIdx : int - The index to start searching from
    searchLength : int - The length of the text to search in
    findNoMoreThan : int - The maximum number of occurrences to find

Returns: ResizeArray<int> Return s list of the indices of the occurrences of the pattern in the text. The distance between these indices may be less than the pattern length Overlapping patterns are returned each time. e.g "abab" in "abababab" will return [0;2;4]

The Knuth-Morris-Pratt Algorithm for finding a pattern within a piece of text. With complexity O(n + m)

text : string

The text to search in

pattern : string

The pattern to search for

searchFromIdx : int

The index to start searching from

searchLength : int

The length of the text to search in

findNoMoreThan : int

The maximum number of occurrences to find

Returns: ResizeArray<int>

Return s list of the indices of the occurrences of the pattern in the text. The distance between these indices may be less than the pattern length Overlapping patterns are returned each time. e.g "abab" in "abababab" will return [0;2;4]

Str.insert startIndex stringToInsert insertIntoThisString

Full Usage: Str.insert startIndex stringToInsert insertIntoThisString

Parameters:
    startIndex : int
    stringToInsert : string
    insertIntoThisString : string

Returns: string

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

startIndex : int
stringToInsert : string
insertIntoThisString : string
Returns: string

Str.isEmpty txt

Full Usage: Str.isEmpty txt

Parameters:
    txt : string

Returns: bool
Modifiers: inline

Checks if the string is null or empty. Uses String.IsNullOrEmpty

txt : string
Returns: bool

Str.isNotEmpty txt

Full Usage: Str.isNotEmpty txt

Parameters:
    txt : string

Returns: bool
Modifiers: inline

Checks if the string is NOT null nor empty. Uses String.IsNullOrEmpty |> not

txt : string
Returns: bool

Str.isNotWhite txt

Full Usage: Str.isNotWhite txt

Parameters:
    txt : string

Returns: bool
Modifiers: inline

Checks if the string is NOT null, empty nor just white space. Uses String.IsNullOrWhiteSpace |> not

txt : string
Returns: bool

Str.isWhite txt

Full Usage: Str.isWhite txt

Parameters:
    txt : string

Returns: bool
Modifiers: inline

Checks if the string is null, empty or just white space. Uses String.IsNullOrWhiteSpace

txt : string
Returns: bool

Str.lastIndexOfChar charToFind stringToSearchIn

Full Usage: Str.lastIndexOfChar charToFind stringToSearchIn

Parameters:
    charToFind : char
    stringToSearchIn : string

Returns: int

Returns the zero-based index position of the last occurrence of a specified Unicode character within this instance. Or -1 if not found.

charToFind : char
stringToSearchIn : string
Returns: int

Str.lastIndexOfCharFrom charToFind startIndex stringToSearchIn

Full Usage: Str.lastIndexOfCharFrom charToFind startIndex stringToSearchIn

Parameters:
    charToFind : char
    startIndex : int
    stringToSearchIn : string

Returns: int

Returns 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. Or -1 if not found.

charToFind : char
startIndex : int
stringToSearchIn : string
Returns: int

Str.lastIndexOfString stringToFind stringToSearchIn

Full Usage: Str.lastIndexOfString stringToFind stringToSearchIn

Parameters:
    stringToFind : string
    stringToSearchIn : string

Returns: int

Returns the zero-based index position of the last occurrence of a specified string within this instance, using StringComparison.Ordinal. Or -1 if not found.

stringToFind : string
stringToSearchIn : string
Returns: int

Str.lastIndexOfStringFrom stringToFind startIndex stringToSearchIn

Full Usage: Str.lastIndexOfStringFrom stringToFind startIndex stringToSearchIn

Parameters:
    stringToFind : string
    startIndex : int
    stringToSearchIn : string

Returns: int

Returns 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, using StringComparison.Ordinal. Or -1 if not found.

stringToFind : string
startIndex : int
stringToSearchIn : string
Returns: int

Str.low1 txt

Full Usage: Str.low1 txt

Parameters:
    txt : string

Returns: string

Makes First letter of string to Lowercase if possible.

txt : string
Returns: string

Str.normalize txt

Full Usage: Str.normalize txt

Parameters:
    txt : string

Returns: string

Removes accents & diacritics from characters first does txt.Normalize(System.Text.NormalizationForm.FormD) and then removes all non-spacing marks eventually returns string.Normalize(NormalizationForm.FormC) (in Fable this just call txt.normalize("NFKD") instead)

txt : string
Returns: string

Str.notContains stringToFind stringToSearchIn

Full Usage: Str.notContains stringToFind stringToSearchIn

Parameters:
    stringToFind : string
    stringToSearchIn : string

Returns: bool

Returns true if a specified substring does NOT occurs within this string.

stringToFind : string
stringToSearchIn : string
Returns: bool

Str.notContainsChar charToFind stringToSearchIn

Full Usage: Str.notContainsChar charToFind stringToSearchIn

Parameters:
    charToFind : char
    stringToSearchIn : string

Returns: bool

Returns true if specified character does NOT occurs within this string.

charToFind : char
stringToSearchIn : string
Returns: bool

Str.padLeft totalWidth txt

Full Usage: Str.padLeft totalWidth txt

Parameters:
    totalWidth : int
    txt : string

Returns: 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.

totalWidth : int
txt : string
Returns: string

Str.padLeftWith totalWidth paddingChar txt

Full Usage: Str.padLeftWith totalWidth paddingChar txt

Parameters:
    totalWidth : int
    paddingChar : char
    txt : string

Returns: 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.

totalWidth : int
paddingChar : char
txt : string
Returns: string

Str.padRight totalWidth txt

Full Usage: Str.padRight totalWidth txt

Parameters:
    totalWidth : int
    txt : string

Returns: 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.

totalWidth : int
txt : string
Returns: string

Str.padRightWith totalWidth paddingChar txt

Full Usage: Str.padRightWith totalWidth paddingChar txt

Parameters:
    totalWidth : int
    paddingChar : char
    txt : string

Returns: 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.

totalWidth : int
paddingChar : char
txt : string
Returns: string

Str.remove startIndex txt

Full Usage: Str.remove startIndex txt

Parameters:
    startIndex : int
    txt : string

Returns: 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.

startIndex : int
txt : string
Returns: string

Str.removeFrom startIndex count txt

Full Usage: Str.removeFrom startIndex count txt

Parameters:
    startIndex : int
    count : int
    txt : string

Returns: string

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

startIndex : int
count : int
txt : string
Returns: string

Str.replace oldValue newValue txt

Full Usage: Str.replace oldValue newValue txt

Parameters:
    oldValue : string
    newValue : string
    txt : string

Returns: string

Returns a new string in which all occurrences of a specified string in the current instance are replaced with another specified string. (Will return the same instance if text to replace is not found)

oldValue : string
newValue : string
txt : string
Returns: string

Str.replaceChar oldChar newChar txt

Full Usage: Str.replaceChar oldChar newChar txt

Parameters:
    oldChar : char
    newChar : char
    txt : string

Returns: string

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

oldChar : char
newChar : char
txt : string
Returns: string

Str.replaceFirst oldValue newValue txt

Full Usage: Str.replaceFirst oldValue newValue txt

Parameters:
    oldValue : string
    newValue : string
    txt : string

Returns: string

Returns a new string in which only the first occurrences of a specified string in the current instance is replaced with another specified string. (Will return the same instance if text to replace is not found)

oldValue : string
newValue : string
txt : string
Returns: string

Str.replaceLast oldValue newValue txt

Full Usage: Str.replaceLast oldValue newValue txt

Parameters:
    oldValue : string
    newValue : string
    txt : string

Returns: string

Returns a new string in which only the last occurrences of a specified string in the current instance is replaced with another specified string. (Will return the same instance if text to replace is not found)

oldValue : string
newValue : string
txt : string
Returns: string

Str.skip skipLength fromString

Full Usage: Str.skip skipLength fromString

Parameters:
    skipLength : int
    fromString : string

Returns: string

Remove characters from the starts. fromString.Substring(skipLength)

skipLength : int
fromString : string
Returns: string

Str.slice startIdx endIdx txt

Full Usage: Str.slice startIdx endIdx txt

Parameters:
    startIdx : int
    endIdx : int
    txt : string

Returns: string

Allows for negative indices too. -1 is last character The resulting string includes the end index.

startIdx : int
endIdx : int
txt : string
Returns: string

Str.split splitter stringToSplit

Full Usage: Str.split splitter stringToSplit

Parameters:
    splitter : string
    stringToSplit : string

Returns: string[]

Split string, Remove Empty Entries Like: string.Split([| splitter |], StringSplitOptions.RemoveEmptyEntries)

splitter : string
stringToSplit : string
Returns: string[]

Str.splitChar separator stringToSplit

Full Usage: Str.splitChar separator stringToSplit

Parameters:
    separator : char
    stringToSplit : string

Returns: string[]

Split string by a Char, Remove Empty Entries Like: string.Split([| splitter |], StringSplitOptions.RemoveEmptyEntries)

separator : char
stringToSplit : string
Returns: string[]

Str.splitCharKeep separator stringToSplit

Full Usage: Str.splitCharKeep separator stringToSplit

Parameters:
    separator : char
    stringToSplit : string

Returns: string[]

Split string by any of multiple Chars, Keep Empty Entries Like : string.Split([| splitter |], StringSplitOptions.None)

separator : char
stringToSplit : string
Returns: string[]

Str.splitChars separators stringToSplit

Full Usage: Str.splitChars separators stringToSplit

Parameters:
    separators : char[]
    stringToSplit : string

Returns: string[]

Split string by any of multiple Chars, Remove Empty Entries Like: string.Split([| splitter |], StringSplitOptions.RemoveEmptyEntries)

separators : char[]
stringToSplit : string
Returns: string[]

Str.splitCharsKeep separators stringToSplit

Full Usage: Str.splitCharsKeep separators stringToSplit

Parameters:
    separators : char[]
    stringToSplit : string

Returns: string[]

Split string by a Char, Keep Empty Entries Like : string.Split([| splitter |], StringSplitOptions.None)

separators : char[]
stringToSplit : string
Returns: string[]

Str.splitKeep splitter stringToSplit

Full Usage: Str.splitKeep splitter stringToSplit

Parameters:
    splitter : string
    stringToSplit : string

Returns: string[]

Split string, Keep Empty Entries Like : string.Split([| splitter |], StringSplitOptions.None)

splitter : string
stringToSplit : string
Returns: string[]

Str.splitLines stringToSplit

Full Usage: Str.splitLines stringToSplit

Parameters:
    stringToSplit : string

Returns: string[]

Split string by "\r\n", "\r" and "\n"

stringToSplit : string
Returns: string[]

Str.splitOnce splitter stringToSplit

Full Usage: Str.splitOnce splitter stringToSplit

Parameters:
    splitter : string
    stringToSplit : string

Returns: string * string

Split string into two elements, Fails if splitter is not found. The splitter is not included in the two return strings.

splitter : string
stringToSplit : string
Returns: string * string

Str.splitTwice firstSplitter secondSplitter stringToSplit

Full Usage: Str.splitTwice firstSplitter secondSplitter stringToSplit

Parameters:
    firstSplitter : string
    secondSplitter : string
    stringToSplit : string

Returns: string * string * string

Finds text before, between and after two strings. e.g.: between "X" "T" "cXabTk" = "c", "ab", "k" Fails if not both splitters are found. Delimiters are excluded in the three returned strings

firstSplitter : string
secondSplitter : string
stringToSplit : string
Returns: string * string * string

Str.startsWith stringToFindAtStart stringToSearchIn

Full Usage: Str.startsWith stringToFindAtStart stringToSearchIn

Parameters:
    stringToFindAtStart : string
    stringToSearchIn : string

Returns: bool

Determines whether the beginning of this string instance matches the specified string, using StringComparison.Ordinal..

stringToFindAtStart : string
stringToSearchIn : string
Returns: bool

Str.startsWithIgnoreCase stringToFindAtStart stringToSearchIn

Full Usage: Str.startsWithIgnoreCase stringToFindAtStart stringToSearchIn

Parameters:
    stringToFindAtStart : string
    stringToSearchIn : string

Returns: bool

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

stringToFindAtStart : string
stringToSearchIn : string
Returns: bool

Str.substringFrom startIndex txt

Full Usage: Str.substringFrom startIndex txt

Parameters:
    startIndex : int
    txt : string

Returns: string

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

startIndex : int
txt : string
Returns: string

Str.substringFromFor startIndex length txt

Full Usage: Str.substringFromFor startIndex length txt

Parameters:
    startIndex : int
    length : int
    txt : string

Returns: string

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

startIndex : int
length : int
txt : string
Returns: string

Str.take takeLength fromString

Full Usage: Str.take takeLength fromString

Parameters:
    takeLength : int
    fromString : string

Returns: string

Takes a given amount of chars from string. Fails if input is shorter than takeLength. Use String.truncate instead if you want to avoid failing in that case. Code: fromString.Substring(0,takeLength)

takeLength : int
fromString : string
Returns: string

Str.toCharArray txt

Full Usage: Str.toCharArray txt

Parameters:
    txt : string

Returns: char[]

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

txt : string
Returns: char[]

Str.toCharArrayFromFor startIndex length txt

Full Usage: Str.toCharArrayFromFor startIndex length txt

Parameters:
    startIndex : int
    length : int
    txt : string

Returns: char[]

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

startIndex : int
length : int
txt : string
Returns: char[]

Str.toLower txt

Full Usage: Str.toLower txt

Parameters:
    txt : string

Returns: string

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

txt : string
Returns: string

Str.toUpper txt

Full Usage: Str.toUpper txt

Parameters:
    txt : string

Returns: string

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

txt : string
Returns: string

Str.trim txt

Full Usage: Str.trim txt

Parameters:
    txt : string

Returns: string

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

txt : string
Returns: string

Str.trimChar trimChar txt

Full Usage: Str.trimChar trimChar txt

Parameters:
    trimChar : char
    txt : string

Returns: string

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

trimChar : char
txt : string
Returns: string

Str.trimChars trimChars txt

Full Usage: Str.trimChars trimChars txt

Parameters:
    trimChars : char[]
    txt : string

Returns: string

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

trimChars : char[]
txt : string
Returns: string

Str.trimEnd txt

Full Usage: Str.trimEnd txt

Parameters:
    txt : string

Returns: string

Removes all trailing whitespace.

txt : string
Returns: string

Str.trimEndChar trimChar txt

Full Usage: Str.trimEndChar trimChar txt

Parameters:
    trimChar : char
    txt : string

Returns: string

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

trimChar : char
txt : string
Returns: string

Str.trimEndChars trimChars txt

Full Usage: Str.trimEndChars trimChars txt

Parameters:
    trimChars : char[]
    txt : string

Returns: string

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

trimChars : char[]
txt : string
Returns: string

Str.trimStart txt

Full Usage: Str.trimStart txt

Parameters:
    txt : string

Returns: string

Removes all leading whitespace.

txt : string
Returns: string

Str.trimStartChar trimChar txt

Full Usage: Str.trimStartChar trimChar txt

Parameters:
    trimChar : char
    txt : string

Returns: string

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

trimChar : char
txt : string
Returns: string

Str.trimStartChars trimChars txt

Full Usage: Str.trimStartChars trimChars txt

Parameters:
    trimChars : char[]
    txt : string

Returns: string

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

trimChars : char[]
txt : string
Returns: string

Str.truncate truncateLength fromString

Full Usage: Str.truncate truncateLength fromString

Parameters:
    truncateLength : int
    fromString : string

Returns: string

Takes at most a given amount of chars from string. If input is shorter than truncateLength returns input string unchanged. Alternatively use the functions that include formatting: Str.Format.stringTruncated and Str.Format.stringInOneLine Str.Format.stringTruncatedToMaxLines

truncateLength : int
fromString : string
Returns: string

Str.tryAfter splitter stringToSearchIn

Full Usage: Str.tryAfter splitter stringToSearchIn

Parameters:
    splitter : string
    stringToSearchIn : string

Returns: string option

Returns everything after first occurrence of a given splitting string. Or None if splitter is not found Uses StringComparison.Ordinal

splitter : string
stringToSearchIn : string
Returns: string option

Str.tryAfterChar splitter stringToSearchIn

Full Usage: Str.tryAfterChar splitter stringToSearchIn

Parameters:
    splitter : char
    stringToSearchIn : string

Returns: string option

Returns everything after first occurrence of a given splitting character. Or None if splitter is not found

splitter : char
stringToSearchIn : string
Returns: string option

Str.tryBefore splitter stringToSearchIn

Full Usage: Str.tryBefore splitter stringToSearchIn

Parameters:
    splitter : string
    stringToSearchIn : string

Returns: string option

Returns everything before first occurrence of a given splitting string. Or None if splitter is not found. Uses StringComparison.Ordinal

splitter : string
stringToSearchIn : string
Returns: string option

Str.tryBeforeChar splitter stringToSearchIn

Full Usage: Str.tryBeforeChar splitter stringToSearchIn

Parameters:
    splitter : char
    stringToSearchIn : string

Returns: string option

Returns everything before first occurrence of a given splitting character. Or None if splitter is not found.

splitter : char
stringToSearchIn : string
Returns: string option

Str.tryBetween firstSplitter secondSplitter stringToSplit

Full Usage: Str.tryBetween firstSplitter secondSplitter stringToSplit

Parameters:
    firstSplitter : string
    secondSplitter : string
    stringToSplit : string

Returns: string option

Finds text between two strings e.g.: between "X" "T" "cXabTk" = "ab" Returns None if not both splitters are found. Delimiters are excluded in the returned strings

firstSplitter : string
secondSplitter : string
stringToSplit : string
Returns: string option

Str.tryBetweenChars firstSplitter secondSplitter stringToSplit

Full Usage: Str.tryBetweenChars firstSplitter secondSplitter stringToSplit

Parameters:
    firstSplitter : Char
    secondSplitter : Char
    stringToSplit : string

Returns: string option

Finds text between two Characters e.g.: between 'X' 'T' "cXabTk" = "ab" Returns None if not both splitters are found. Delimiters are excluded in the returned strings

firstSplitter : Char
secondSplitter : Char
stringToSplit : string
Returns: string option

Str.trySplitOnce splitter stringToSplit

Full Usage: Str.trySplitOnce splitter stringToSplit

Parameters:
    splitter : string
    stringToSplit : string

Returns: (string * string) option

Split string into two elements, If splitter not found None is returned Splitter is not included in the two return strings.

splitter : string
stringToSplit : string
Returns: (string * string) option

Str.trySplitTwice firstSplitter secondSplitter stringToSplit

Full Usage: Str.trySplitTwice firstSplitter secondSplitter stringToSplit

Parameters:
    firstSplitter : string
    secondSplitter : string
    stringToSplit : string

Returns: (string * string * string) option

Finds text before, between and after two strings. e.g.: between "X" "T" "cXabTk" = "c", "ab", "k" If not both splitters are found returns None Delimiters are excluded in the three returned strings

firstSplitter : string
secondSplitter : string
stringToSplit : string
Returns: (string * string * string) option

Str.unifyLineEndings txt

Full Usage: Str.unifyLineEndings txt

Parameters:
    txt : string

Returns: string

Ensures all lines end on System.Environment.NewLine Code: StringBuilder(s).Replace("\r\n", "\n").Replace("\r", "\n").Replace("\n", Environment.NewLine).ToString()

txt : string
Returns: string

Str.up1 txt

Full Usage: Str.up1 txt

Parameters:
    txt : string

Returns: string

Makes First letter of string to Uppercase if possible.

txt : string
Returns: string

Type something to start searching.