BogaNet 1.4.0
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
BogaNet.Extension.StringExtension Class Reference

Extension methods for strings. More...

Static Public Member Functions

static string BNReverse (this string str)
 Reverses a string.
 
static string BNReplace (this string? str, string? oldString, string? newString, StringComparison comp=StringComparison.OrdinalIgnoreCase)
 Case insensitive 'Replace' per default.
 
static string BNRemoveChars (this string? str, params char[]? removeChars)
 Removes characters from a string.
 
static bool BNEquals (this string? str, string? toCheck, StringComparison comp=StringComparison.OrdinalIgnoreCase)
 Case insensitive 'Equals' per default.
 
static bool BNContains (this string? str, string? toCheck, StringComparison comp=StringComparison.OrdinalIgnoreCase)
 Case insensitive 'Contains' per default.
 
static bool BNContainsAny (this string? str, params string[]? searchTerms)
 Contains any given string.
 
static bool BNContainsAll (this string? str, params string[]? searchTerms)
 Contains all given strings.
 
static bool BNStartsWith (this string? str, string? toCheck, StringComparison comp=StringComparison.OrdinalIgnoreCase)
 Checks if the string starts with another string.
 
static bool BNEndsWith (this string? str, string? toCheck, StringComparison comp=StringComparison.OrdinalIgnoreCase)
 Checks if the string ends with another string.
 
static int BNLastIndexOf (this string? str, string? toCheck, StringComparison comp=StringComparison.OrdinalIgnoreCase)
 Returns the index of the last occurence of a given string.
 
static int BNIndexOf (this string? str, string? toCheck, StringComparison comp=StringComparison.OrdinalIgnoreCase)
 Returns the index of the first occurence of a given string.
 
static byte[] BNToByteArray (this string str, Encoding? encoding=null)
 Converts the value of a string to a byte-array.
 
static string BNToString (this byte[] bytes, Encoding? encoding=null, int offset=0, int length=0)
 Converts a byte-array to a string.
 

Detailed Description

Extension methods for strings.

Member Function Documentation

◆ BNContains()

static bool BogaNet.Extension.StringExtension.BNContains ( this string? str,
string? toCheck,
StringComparison comp = StringComparison::OrdinalIgnoreCase )
static

Case insensitive 'Contains' per default.

Parameters
strString-instance
toCheckString to check
compStringComparison-method (optional, default: StringComparison.OrdinalIgnoreCase)
Returns
True if the string contains the given string

◆ BNContainsAll()

static bool BogaNet.Extension.StringExtension.BNContainsAll ( this string? str,
params string?[] searchTerms )
static

Contains all given strings.

Parameters
strString-instance
searchTermsSearch terms separated by the given split-character
Returns
True if the string contains all parts of the given string

◆ BNContainsAny()

static bool BogaNet.Extension.StringExtension.BNContainsAny ( this string? str,
params string?[] searchTerms )
static

Contains any given string.

Parameters
strString-instance
searchTermsSearch terms separated by the given split-character
Returns
True if the string contains any parts of the given string

◆ BNEndsWith()

static bool BogaNet.Extension.StringExtension.BNEndsWith ( this string? str,
string? toCheck,
StringComparison comp = StringComparison::OrdinalIgnoreCase )
static

Checks if the string ends with another string.

Parameters
strString-instance
toCheckString to check
compStringComparison-method (optional, default: StringComparison.OrdinalIgnoreCase)
Returns
True if the string is integer

◆ BNEquals()

static bool BogaNet.Extension.StringExtension.BNEquals ( this string? str,
string? toCheck,
StringComparison comp = StringComparison::OrdinalIgnoreCase )
static

Case insensitive 'Equals' per default.

Parameters
strString-instance
toCheckString to check
compStringComparison-method (optional, default: StringComparison.OrdinalIgnoreCase)
Returns
True if the string contains the given string

◆ BNIndexOf()

static int BogaNet.Extension.StringExtension.BNIndexOf ( this string? str,
string? toCheck,
StringComparison comp = StringComparison::OrdinalIgnoreCase )
static

Returns the index of the first occurence of a given string.

Parameters
strString-instance
toCheckString for the index
compStringComparison-method (optional, default: StringComparison.OrdinalIgnoreCase)
Returns
The index of the first occurence of the given string if the string is integer

◆ BNLastIndexOf()

static int BogaNet.Extension.StringExtension.BNLastIndexOf ( this string? str,
string? toCheck,
StringComparison comp = StringComparison::OrdinalIgnoreCase )
static

Returns the index of the last occurence of a given string.

Parameters
strString-instance
toCheckString for the index
compStringComparison-method (optional, default: StringComparison.OrdinalIgnoreCase)
Returns
The index of the last occurence of the given string if the string is integer

◆ BNRemoveChars()

static string BogaNet.Extension.StringExtension.BNRemoveChars ( this string? str,
params char?[] removeChars )
static

Removes characters from a string.

Parameters
strString-instance
removeCharsCharacters to remove
Returns
String without the given characters

◆ BNReplace()

static string BogaNet.Extension.StringExtension.BNReplace ( this string? str,
string? oldString,
string? newString,
StringComparison comp = StringComparison::OrdinalIgnoreCase )
static

Case insensitive 'Replace' per default.

Parameters
strString-instance
oldStringString to replace
newStringNew replacement string
compStringComparison-method (optional, default: StringComparison.OrdinalIgnoreCase)
Returns
Replaced string

◆ BNReverse()

static string BogaNet.Extension.StringExtension.BNReverse ( this string str)
static

Reverses a string.

Parameters
strString-instance
Returns
Reversed string

◆ BNStartsWith()

static bool BogaNet.Extension.StringExtension.BNStartsWith ( this string? str,
string? toCheck,
StringComparison comp = StringComparison::OrdinalIgnoreCase )
static

Checks if the string starts with another string.

Parameters
strString-instance
toCheckString to check
compStringComparison-method (optional, default: StringComparison.OrdinalIgnoreCase)
Returns
True if the string is integer

◆ BNToByteArray()

static byte[] BogaNet.Extension.StringExtension.BNToByteArray ( this string str,
Encoding? encoding = null )
static

Converts the value of a string to a byte-array.

Parameters
strInput string
encodingEncoding of the string (optional, default: UTF8)
Returns
Byte-array with the string

◆ BNToString()

static string BogaNet.Extension.StringExtension.BNToString ( this byte[] bytes,
Encoding? encoding = null,
int offset = 0,
int length = 0 )
static

Converts a byte-array to a string.

Parameters
bytesInput string as byte-array
encodingEncoding of the string (optional, default: UTF8)
offsetOffset inside the byte-array (optional, default: 0)
lengthNumber of bytes (optional, default: 0 = all)
Returns
String from the byte-array
Exceptions
ArgumentNullException

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