Semi Mod Loader
Classes | Static Public Member Functions | List of all members
Semi.StringExt Class Reference

Classes

struct  SplitPair
 Result of SplitIntoPair More...
 

Static Public Member Functions

static bool StartsWithInvariant (this string s, string v, bool ignore_case=false)
 Quality of life extension method to check whether a string starts with another string using invariant culture. More...
 
static bool EndsWithInvariant (this string s, string v, bool ignore_case=false)
 Quality of life extension method to check whether a string ends with another string using invariant culture. More...
 
static string ToPlatformPath (this string s)
 Converts Windows directory separators in a path to the appropriate one for the platform if necessary. More...
 
static string RemovePrefix (this string s, string prefix)
 Removes the prefix if the string has one. More...
 
static string RemoveSuffix (this string s, string suffix)
 Removes the suffix if the string has one. More...
 
static string ToTitleCaseInvariant (this string s)
 Quality of life extension method to turn the string into title case using invariant culture. More...
 
static bool IsPureASCII (this string input)
 Detects whether the string consists of just ASCII (0-255) characters. More...
 
static int Count (this string @in, char c)
 Counts occurences of a single character in a string. More...
 
static string FirstFromSplit (this string source, char delimiter)
 Gets the first element of the string if it was split by delimiter, without actually splitting the string (and using up memory). More...
 
static string FirstFromSplit (this string source, string delimiter)
 Gets the first element of the string if it was split by delimiter, without actually splitting the string (and using up memory). More...
 
static SplitPair SplitIntoPair (this string source, string delimiter)
 Splits a string into a pair of the first element and everything past the first delimiter. More...
 

Member Function Documentation

◆ Count()

static int Semi.StringExt.Count ( this string @  in,
char  c 
)
inlinestatic

Counts occurences of a single character in a string.

Returns
The number of times that the character appears in the string.
Parameters
inTarget string.
cCharacter to count.

◆ EndsWithInvariant()

static bool Semi.StringExt.EndsWithInvariant ( this string  s,
string  v,
bool  ignore_case = false 
)
inlinestatic

Quality of life extension method to check whether a string ends with another string using invariant culture.

Returns
true, if the string ends with the provided text, false otherwise.
Parameters
sTarget string.
vSuffix string to check.
ignore_caseIf set to true ignore case.

◆ FirstFromSplit() [1/2]

static string Semi.StringExt.FirstFromSplit ( this string  source,
char  delimiter 
)
inlinestatic

Gets the first element of the string if it was split by delimiter, without actually splitting the string (and using up memory).

Returns
The first element, or the same string if the delimiter doesn't occur at all.
Parameters
sourceTarget string.
delimiterDelimiter.

◆ FirstFromSplit() [2/2]

static string Semi.StringExt.FirstFromSplit ( this string  source,
string  delimiter 
)
inlinestatic

Gets the first element of the string if it was split by delimiter, without actually splitting the string (and using up memory).

Returns
The first element, or the same string if the delimiter doesn't occur at all.
Parameters
sourceTarget string.
delimiterDelimiter.

◆ IsPureASCII()

static bool Semi.StringExt.IsPureASCII ( this string  input)
inlinestatic

Detects whether the string consists of just ASCII (0-255) characters.

Returns
true, if string is pure ASCII, false otherwise.
Parameters
inputTarget string.

◆ RemovePrefix()

static string Semi.StringExt.RemovePrefix ( this string  s,
string  prefix 
)
inlinestatic

Removes the prefix if the string has one.

Returns
The string with the prefix removed, or the same string if it doesn't have the specified prefix.
Parameters
sTarget string.
prefixPrefix string.

◆ RemoveSuffix()

static string Semi.StringExt.RemoveSuffix ( this string  s,
string  suffix 
)
inlinestatic

Removes the suffix if the string has one.

Returns
The string with the suffix removed, or the same string if it doesn't have the specified suffix.
Parameters
sTarget string.
suffixSuffix string.

◆ SplitIntoPair()

static SplitPair Semi.StringExt.SplitIntoPair ( this string  source,
string  delimiter 
)
inlinestatic

Splits a string into a pair of the first element and everything past the first delimiter.

Returns
The string pair.
Parameters
sourceTarget string.
delimiterDelimiter.

◆ StartsWithInvariant()

static bool Semi.StringExt.StartsWithInvariant ( this string  s,
string  v,
bool  ignore_case = false 
)
inlinestatic

Quality of life extension method to check whether a string starts with another string using invariant culture.

Returns
true, if the string starts with the provided text, false otherwise.
Parameters
sTarget string.
vPrefix string to check.
ignore_caseIf set to true ignore case.

◆ ToPlatformPath()

static string Semi.StringExt.ToPlatformPath ( this string  s)
inlinestatic

Converts Windows directory separators in a path to the appropriate one for the platform if necessary.

Returns
The same path if on Windows, or a path with backward slashes turned into forward slashes on other platforms.
Parameters
sS.

◆ ToTitleCaseInvariant()

static string Semi.StringExt.ToTitleCaseInvariant ( this string  s)
inlinestatic

Quality of life extension method to turn the string into title case using invariant culture.

Returns
The string turned into title case.
Parameters
sTarget string.

The documentation for this class was generated from the following file: