An extension for the string class in .net
- Capitalize : Capitalize the string
- CapitalizeAllWords : Capitalize all the words into a string (separated by spaces)
- IsValidEmail : Check if the string is a valid mail
- IsNullOrEmpty : Check if the string is null or empty
- ConcatWithChar : Concat the current string with another, using a specified character
- ConcatWithChar : Concat the current string with other strings, using a specified character
- ConcatWithoutChar : Concat the current string with another without a character
- ConcatWithoutChar : Concat the current string with other strings without a character
- RemoveLastCharacter : Remove the last character
- RemoveFirstCharacter : Remove the first character
- RemoveCharacterAt : Remove character at position x
- RandomString : Get a random string generated from the current (same length)
- RemoveChar : Remove all occurences of a character from the string
- HasSubstring : Check if the string has a substring (case sensitive)
- HasSubstringInsensitive : Check if the string has a substring (case insensitive)
- ToStream : Convert string to stream
- ToBytes : Convert string to bytes array
- ToEncodedUrl : Encode the url
- ToDecodedUrl : Decode the url
- IsValidHttpUrl : Check if the string is a valid HTTP Url
- ToInt: Return the string like an int (default value args)
- ToLong: Return the string like an long (default value args)
- ToDouble: Return the string like an double (default value args)
- ToFloat: Return the string like an float (default value args)
- WordCount : Count the word in a string
- RemoveDuplicateSpaces : Remove duplicated spaces and tabs
- ToEmptyIfNull : Return the empty string (to prevent NullRefernceException)
- GetFileExtension : Return the file extension for a path
- CountCharacters : Return the number of characters into the string
- IsMatch : Quick match for regexp
- IsNumber : Quick check if string is a valid number
- IsAlphanumeric : Quick check if string is alphanumeric
- IsAlphabetic : Quick check if string is alphabetic
- EllipsisEnd : Add the ellipsis if the string has length > maxLength
- Formatted : Return the string formatted with the arguments
- Specular : Return the specular string
- GetDictionary : Return a dictionary from a string with structure var{valueSeparator}val{separator}var1{valueSeparator}val1{separator}... (ex. a query string)
- AddSlashes : Add slashes to \,',"
- IsPalindrome : return true if the string is a palindrome
- Compact : Compat the string in the passed lenght.
- Alternative : Return an alternative text if string is empty
- ToHtmlDecode : Return the html decoded string
- ToHtmlEncode : Return encoded html string
- Camelize : Return the camelized string
- IsValidPassword : Check if a string is avalid password
- GetHashString : Get hashed string
You can use it with dot notation from a string,
var myString = "pippo".Capitalize();
//now myString is "Pippo"
var today = "today is a great day and i'm here!".RemoveDuplicateSpaces().CapitalizeAllWords();
//now today is "Today Is A Great Day And I'm Here!"
You can find it on nuget with the name DewStrings