String Module
String utility functions — functional wrappers over String methods.
Functions and values
| Function or value |
Description
|
Full Usage:
String.contains value str
Parameters:
string
str : string
Returns: bool
Modifiers: inline |
Returns true if str contains value (ordinal). The substring to search for. The string to search in.
|
Full Usage:
String.countOccurrences substr str
Parameters:
string
-
The substring to count.
str : string
-
The string to search in.
Returns: int
Number of occurrences; 0 for empty input or empty substr.
|
Counts the number of non-overlapping occurrences of substr in str.
Example
module String
from Microsoft.FSharp.Core
|
Full Usage:
String.defaultIfEmpty defaultValue str
Parameters:
string
str : string
Returns: string
Modifiers: inline |
Returns the default value if the string is null or empty. The fallback value. The string to test.
|
Full Usage:
String.endsWith value str
Parameters:
string
str : string
Returns: bool
Modifiers: inline |
Returns true if str ends with value. The suffix to look for. The string to check.
|
Full Usage:
String.isNotNullOrWhiteSpace
Returns: string -> bool
|
Returns true if string is not null/empty/whitespace.
|
Full Usage:
String.isNullOrEmpty value
Parameters:
string
Returns: bool
|
Returns true if the string is null or empty (no whitespace check).
|
Full Usage:
String.isNullOrWhiteSpace value
Parameters:
string
Returns: bool
|
Returns true if string is null, empty, or only whitespace.
|
Full Usage:
String.join separator values
Parameters:
string
values : string seq
Returns: string
Modifiers: inline |
Joins a sequence of strings with the given separator. The delimiter placed between elements. The strings to join.
|
Full Usage:
String.padLeft totalWidth str
Parameters:
int
str : string
Returns: string
Modifiers: inline |
Pads the string on the left to the given total width. The desired total length after padding. The string to pad.
|
Full Usage:
String.padRight totalWidth str
Parameters:
int
str : string
Returns: string
Modifiers: inline |
Pads the string on the right to the given total width. The desired total length after padding. The string to pad.
|
Full Usage:
String.remove value str
Parameters:
string
str : string
Returns: string
Modifiers: inline |
Removes all occurrences of value from the string. The substring to remove. The input string.
|
Full Usage:
String.replace oldValue newValue str
Parameters:
string
newValue : string
str : string
Returns: string
Modifiers: inline |
Replaces all occurrences of oldValue with newValue. The substring to find. The replacement string. The input string.
|
Full Usage:
String.replaceEndLines replacementText str
Parameters:
string
str : string
Returns: string
|
Replaces all line-ending sequences with the given replacement text. The text to substitute for line endings. The input string.
|
Full Usage:
String.split separator str
Parameters:
string
str : string
Returns: string[]
Modifiers: inline |
Splits a string by the given separator. The delimiter string. The string to split.
|
Full Usage:
String.splitChar separator str
Parameters:
char
str : string
Returns: string[]
Modifiers: inline |
Splits a string by the given char separator. The delimiter character. The string to split.
|
Full Usage:
String.startsWith value str
Parameters:
string
str : string
Returns: bool
Modifiers: inline |
Returns true if the string starts with the given prefix. The prefix to look for. The string to check.
|
Full Usage:
String.startsWithAny values str
Parameters:
string[]
-
The prefixes to test against.
str : string
-
The string to check.
Returns: bool
|
Returns
|
Full Usage:
String.substring idx str
Parameters:
int
str : string
Returns: string
Modifiers: inline |
Returns the substring starting at the given index. The zero-based start index. The input string.
|
Full Usage:
String.substringLen idx length str
Parameters:
int
length : int
str : string
Returns: string
Modifiers: inline |
Returns the substring starting at idx with the given length. The zero-based start index. The number of characters to extract. The input string.
|
Full Usage:
String.toLower str
Parameters:
string
Returns: string
|
Converts a string to lowercase using the current culture. The string to convert.
|
Full Usage:
String.toLowerInv str
Parameters:
string
Returns: string
|
Converts a string to lowercase using invariant culture. The string to convert.
|
Full Usage:
String.toOption s
Parameters:
string
-
The string to evaluate.
Returns: string option
Modifiers: inline |
Returns
|
Full Usage:
String.toUpper str
Parameters:
string
Returns: string
|
Converts a string to uppercase using the current culture. The string to convert.
|
Full Usage:
String.toUpperInv str
Parameters:
string
Returns: string
|
Converts a string to uppercase using invariant culture. The string to convert.
|
Full Usage:
String.trim str
Parameters:
string
Returns: string
Modifiers: inline |
Removes leading and trailing whitespace. The string to trim.
|
Full Usage:
String.trimEnd str
Parameters:
string
Returns: string
Modifiers: inline |
Removes trailing whitespace. The string to trim.
|
Full Usage:
String.trimStart str
Parameters:
string
Returns: string
Modifiers: inline |
Removes leading whitespace. The string to trim.
|
Full Usage:
String.truncate maxLen str
Parameters:
int
-
Maximum length of the returned string.
str : string
-
The string to truncate.
Returns: string
|
Returns at most maxLen characters from the start of the string. Null-safe: returns null if input is null.
Example
module String
from Microsoft.FSharp.Core
|
TDesu.FSharp