Volume Control
Application-specific hotkeys for Windows
VolumeControl.TypeExtensions.StringExtensions Class Reference

Extensions for string types. More...

Collaboration diagram for VolumeControl.TypeExtensions.StringExtensions:

Static Public Member Functions

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

Detailed Description

Extensions for string types.

Member Function Documentation

◆ 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
sThe string that this extension method was called on.
indexThe target index within the string to access.
defaultCharA 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
sA string.
sCompareTypeThe StringComparison to use.
compareAny 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
sThe input string.
trimCharsAny 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: