Extensions for string types.
More...
|
static ? SemVersion | GetSemVer (this string? s) |
| Parses a string containing a version number in semantic versioning 2 format. More...
|
|
static string | RemoveIf (this string s, Predicate< char > pred) |
| Removes all chars that pred returns true for. More...
|
|
static string | Trim (this string s, string trimChars) |
| Removes all preceeding/trailing occurrences of the specified characters from a string. More...
|
|
static char | AtIndexOrDefault (this string s, int index, char defaultChar) |
| Gets the char at index , or defaultChar if the index is out of range. More...
|
|
static char | AtIndexOrDefault (this string s, int index) |
| Gets the char at index , or the result of the default keyword if the index is out of range. More...
|
|
static bool | EqualsAny (this string s, StringComparison sCompareType, params string[] compare) |
| Check if s equals any of the given compare strings using sCompareType comparison. More...
|
|
static bool | EqualsAny (this string s, params string[] compare) |
| Check if s equals any of the given compare strings using StringComparison.Ordinal comparison. More...
|
|
Extensions for string types.
◆ AtIndexOrDefault() [1/2]
static char VolumeControl.TypeExtensions.StringExtensions.AtIndexOrDefault |
( |
this string |
s, |
|
|
int |
index |
|
) |
| |
|
static |
Gets the char
at index , or the result of the default
keyword if the index is out of range.
- Returns
- The character at index in s if the index is within range; otherwise
default
.
◆ AtIndexOrDefault() [2/2]
static char VolumeControl.TypeExtensions.StringExtensions.AtIndexOrDefault |
( |
this string |
s, |
|
|
int |
index, |
|
|
char |
defaultChar |
|
) |
| |
|
static |
Gets the char
at index , or defaultChar if the index is out of range.
- Parameters
-
s | The string that this extension method was called on. |
index | The target index within the string to access. |
defaultChar | A character to return when the index is out-of-range. |
- Returns
- The character at index in s if the index is within range; otherwise defaultChar .
◆ EqualsAny() [1/2]
static bool VolumeControl.TypeExtensions.StringExtensions.EqualsAny |
( |
this string |
s, |
|
|
params string[] |
compare |
|
) |
| |
|
static |
Check if s equals any of the given compare strings using StringComparison.Ordinal comparison.
◆ EqualsAny() [2/2]
static bool VolumeControl.TypeExtensions.StringExtensions.EqualsAny |
( |
this string |
s, |
|
|
StringComparison |
sCompareType, |
|
|
params string[] |
compare |
|
) |
| |
|
static |
Check if s equals any of the given compare strings using sCompareType comparison.
- Parameters
-
s | A string. |
sCompareType | The StringComparison to use. |
compare | Any number of strings to compare to s . |
- Returns
true
when s equals at least one of the compare strings; otherwise false
◆ GetSemVer()
static ? SemVersion VolumeControl.TypeExtensions.StringExtensions.GetSemVer |
( |
this string? |
s | ) |
|
|
static |
Parses a string containing a version number in semantic versioning 2 format.
◆ RemoveIf()
static string VolumeControl.TypeExtensions.StringExtensions.RemoveIf |
( |
this string |
s, |
|
|
Predicate< char > |
pred |
|
) |
| |
|
static |
Removes all chars that pred returns true for.
◆ Trim()
static string VolumeControl.TypeExtensions.StringExtensions.Trim |
( |
this string |
s, |
|
|
string |
trimChars |
|
) |
| |
|
static |
Removes all preceeding/trailing occurrences of the specified characters from a string.
- Parameters
-
s | The input string. |
trimChars | Any number of characters in a string. |
- Returns
- String with all preceeding/trailing characters from trimChars removed.
The documentation for this class was generated from the following file:
- /home/runner/work/volume-control/volume-control/VolumeControl.TypeExtensions/StringExtensions.cs