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

Helper methods for strings. More...

Static Public Member Functions

static bool IsNumeric (string? str)
 Checks if the string is numeric.
 
static bool IsInteger (string? str)
 Checks if the string is integer.
 
static bool IsEmail (string? str)
 Checks if the string is an email address.
 
static bool IsWebsite (string? str)
 Checks if the string is a website address.
 
static bool IsCreditcard (string? str)
 Checks if the string is a creditcard.
 
static bool IsAlphanumeric (string? str)
 Checks if the string is alphanumeric.
 
static bool HasLineEndings (string? str)
 Checks if the string has line endings.
 
static string ToTitleCase (string str)
 Converts a string to title case (first letter uppercase).
 
static string GenerateLoremIpsum (int length, int minSentences=1, int maxSentences=int.MaxValue, int minWords=1, int maxWords=15)
 Generates a "Lorem Ipsum" based on various parameters.
 
static string RemoveTags (string? str)
 Cleans a given text from tags.
 
static string RemoveSpaces (string str)
 Cleans a given text from multiple spaces.
 
static string RemoveLineEndings (string str)
 Cleans a given text from line endings.
 
static string CreateFixedLengthString (string? str, int length, char filler=' ', bool padRight=true)
 Creates a fixed length string from a given string.
 
static string CreateString (int length, params char[]? fillerCharacters)
 Creates a string of characters with a given length.
 
static List< string > SplitToLines (string text, bool ignoreCommentedLines=true, int skipHeaderLines=0, int skipFooterLines=0)
 Split the given text to lines and return it as list.
 
static string DecodeFromHTMLString (string input)
 Decodes a HTML encoded string to a normal string.
 
static string EncodeToHTMLString (string input)
 Encodes a normal string to a HTML encoded string.
 
static string EscapeURL (string url)
 Escape the data string in an URL (like spaces etc.).
 
static string RemoveQuotation (string str, string replacement="", bool trim=true)
 Removes or replaces quotations (") in a string (e.g. from a CSV)
 
static string AddQuotation (string str)
 Adds quotations (") to a string (e.g. for a CSV)
 

Detailed Description

Helper methods for strings.

Member Function Documentation

◆ AddQuotation()

static string BogaNet.Helper.StringHelper.AddQuotation ( string str)
static

Adds quotations (") to a string (e.g. for a CSV)

Parameters
str
Returns
String with quotations
Exceptions
ArgumentNullException

◆ CreateFixedLengthString()

static string BogaNet.Helper.StringHelper.CreateFixedLengthString ( string? str,
int length,
char filler = ' ',
bool padRight = true )
static

Creates a fixed length string from a given string.

Parameters
strInput string to fix length
lengthLength of the string
fillerFiller character for the string (optional, default ' ')
padRightRight padding - otherwise left padding (optional, default: true)
Returns
Fix length string

◆ CreateString()

static string BogaNet.Helper.StringHelper.CreateString ( int length,
params char?[] fillerCharacters )
static

Creates a string of characters with a given length.

Parameters
lengthLength of the generated string
fillerCharactersCharacters to fill the string (if more than one character is used, the generated string will be a randomized result of all characters)
Returns
Generated string

◆ DecodeFromHTMLString()

static string BogaNet.Helper.StringHelper.DecodeFromHTMLString ( string input)
static

Decodes a HTML encoded string to a normal string.

Parameters
inputHTML encoded string
Returns
Normal string
Exceptions
ArgumentNullException

◆ EncodeToHTMLString()

static string BogaNet.Helper.StringHelper.EncodeToHTMLString ( string input)
static

Encodes a normal string to a HTML encoded string.

Parameters
inputNormal string
Returns
HTML encoded string
Exceptions
ArgumentNullException

◆ EscapeURL()

static string BogaNet.Helper.StringHelper.EscapeURL ( string url)
static

Escape the data string in an URL (like spaces etc.).

Parameters
url
Returns
Escaped URL
Exceptions
ArgumentNullException

◆ GenerateLoremIpsum()

static string BogaNet.Helper.StringHelper.GenerateLoremIpsum ( int length,
int minSentences = 1,
int maxSentences = int::MaxValue,
int minWords = 1,
int maxWords = 15 )
static

Generates a "Lorem Ipsum" based on various parameters.

Parameters
lengthLength of the text
minSentencesMinimum number of sentences for the text (optional, default: 1)
maxSentencesMaximal number of sentences for the text (optional, default: int.MaxValue)
minWordsMinimum number of words per sentence (optional, default: 1)
maxWordsMaximal number of words per sentence (optional, default: 15)
Returns
"Lorem Ipsum" based on the given parameters

◆ HasLineEndings()

static bool BogaNet.Helper.StringHelper.HasLineEndings ( string? str)
static

Checks if the string has line endings.

Parameters
strString-instance
Returns
True if the string has line endings

◆ IsAlphanumeric()

static bool BogaNet.Helper.StringHelper.IsAlphanumeric ( string? str)
static

Checks if the string is alphanumeric.

Parameters
strString-instance
Returns
True if the string is alphanumeric

◆ IsCreditcard()

static bool BogaNet.Helper.StringHelper.IsCreditcard ( string? str)
static

Checks if the string is a creditcard.

Parameters
strString-instance
Returns
True if the string is a creditcard

◆ IsEmail()

static bool BogaNet.Helper.StringHelper.IsEmail ( string? str)
static

Checks if the string is an email address.

Parameters
strString-instance
Returns
True if the string is an email address

◆ IsInteger()

static bool BogaNet.Helper.StringHelper.IsInteger ( string? str)
static

Checks if the string is integer.

Parameters
strString-instance
Returns
True if the string is integer

◆ IsNumeric()

static bool BogaNet.Helper.StringHelper.IsNumeric ( string? str)
static

Checks if the string is numeric.

Parameters
strString-instance
Returns
True if the string is numeric

◆ IsWebsite()

static bool BogaNet.Helper.StringHelper.IsWebsite ( string? str)
static

Checks if the string is a website address.

Parameters
strString-instance
Returns
True if the string is a website address

◆ RemoveLineEndings()

static string BogaNet.Helper.StringHelper.RemoveLineEndings ( string str)
static

Cleans a given text from line endings.

Parameters
strInput to clean
Returns
Clean text without line endings
Exceptions
ArgumentNullException

◆ RemoveQuotation()

static string BogaNet.Helper.StringHelper.RemoveQuotation ( string str,
string replacement = "",
bool trim = true )
static

Removes or replaces quotations (") in a string (e.g. from a CSV)

Parameters
str
replacementReplacement string for the quotation (optional, default: "")
trimTrim the string (optional, default: true)
Returns
String without quotations
Exceptions
ArgumentNullException

◆ RemoveSpaces()

static string BogaNet.Helper.StringHelper.RemoveSpaces ( string str)
static

Cleans a given text from multiple spaces.

Parameters
strInput to clean
Returns
Clean text without multiple spaces
Exceptions
ArgumentNullException

◆ RemoveTags()

static string BogaNet.Helper.StringHelper.RemoveTags ( string? str)
static

Cleans a given text from tags.

Parameters
strInput to clean
Returns
Clean text without tags
Exceptions
ArgumentNullException

◆ SplitToLines()

static List< string > BogaNet.Helper.StringHelper.SplitToLines ( string text,
bool ignoreCommentedLines = true,
int skipHeaderLines = 0,
int skipFooterLines = 0 )
static

Split the given text to lines and return it as list.

Parameters
textComplete text fragment
ignoreCommentedLinesIgnore commente lines (optional, default: true)
skipHeaderLinesNumber of skipped header lines (optional, default: 0)
skipFooterLinesNumber of skipped footer lines (optional, default: 0)
Returns
Splitted lines as list
Exceptions
ArgumentNullException

◆ ToTitleCase()

static string BogaNet.Helper.StringHelper.ToTitleCase ( string str)
static

Converts a string to title case (first letter uppercase).

Parameters
strString-instance
Returns
Converted string in title case
Exceptions
ArgumentNullException

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