![]() |
BogaNet 1.4.0
|
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) | |
Helper methods for strings.
|
static |
Adds quotations (") to a string (e.g. for a CSV)
str |
ArgumentNullException |
|
static |
Creates a fixed length string from a given string.
str | Input string to fix length |
length | Length of the string |
filler | Filler character for the string (optional, default ' ') |
padRight | Right padding - otherwise left padding (optional, default: true) |
|
static |
Creates a string of characters with a given length.
length | Length of the generated string |
fillerCharacters | Characters to fill the string (if more than one character is used, the generated string will be a randomized result of all characters) |
|
static |
Decodes a HTML encoded string to a normal string.
input | HTML encoded string |
ArgumentNullException |
|
static |
Encodes a normal string to a HTML encoded string.
input | Normal string |
ArgumentNullException |
|
static |
Escape the data string in an URL (like spaces etc.).
url |
ArgumentNullException |
|
static |
Generates a "Lorem Ipsum" based on various parameters.
length | Length of the text |
minSentences | Minimum number of sentences for the text (optional, default: 1) |
maxSentences | Maximal number of sentences for the text (optional, default: int.MaxValue) |
minWords | Minimum number of words per sentence (optional, default: 1) |
maxWords | Maximal number of words per sentence (optional, default: 15) |
|
static |
Checks if the string has line endings.
str | String-instance |
|
static |
Checks if the string is alphanumeric.
str | String-instance |
|
static |
Checks if the string is a creditcard.
str | String-instance |
|
static |
Checks if the string is an email address.
str | String-instance |
|
static |
Checks if the string is integer.
str | String-instance |
|
static |
Checks if the string is numeric.
str | String-instance |
|
static |
Checks if the string is a website address.
str | String-instance |
|
static |
Cleans a given text from line endings.
str | Input to clean |
ArgumentNullException |
|
static |
Removes or replaces quotations (") in a string (e.g. from a CSV)
str | |
replacement | Replacement string for the quotation (optional, default: "") |
trim | Trim the string (optional, default: true) |
ArgumentNullException |
|
static |
Cleans a given text from multiple spaces.
str | Input to clean |
ArgumentNullException |
|
static |
Cleans a given text from tags.
str | Input to clean |
ArgumentNullException |
|
static |
Split the given text to lines and return it as list.
text | Complete text fragment |
ignoreCommentedLines | Ignore commente lines (optional, default: true) |
skipHeaderLines | Number of skipped header lines (optional, default: 0) |
skipFooterLines | Number of skipped footer lines (optional, default: 0) |
ArgumentNullException |
|
static |
Converts a string to title case (first letter uppercase).
str | String-instance |
ArgumentNullException |