public static class StringUtils : object
Member | Description | |
---|---|---|
Base36Decode | Decodes a base36 encoded string to an integer public static long Base36Decode(string input);
|
|
Base36Encode | Encodes an integer into a string by mapping to alpha and digits (36 chars) chars are embedded as lower case public static string Base36Encode(long value);
|
|
BinHexToString | Turns a BinHex string that contains raw byte values into a byte array public static Byte[] BinHexToString(string hex);
|
|
DisplayMemo | Fixes a plain text field for display as HTML by replacing carriage returns with the appropriate br and p tags for breaks. public static string DisplayMemo(string htmlText);
|
|
DisplayMemoEncoded | Method that handles handles display of text by breaking text. Unlike the non-encoded version it encodes any embedded HTML text public static string DisplayMemoEncoded(string text);
|
|
ExpandUrls | Expands links into HTML hyperlinks inside of text or HTML. public static string ExpandUrls(string text,
string target, bool parseFormattedLinks); |
|
ExtractString | Extracts a string from between a pair of delimiters. Only the first instance is found. public static string ExtractString(string source,
string beginDelim, string endDelim, bool caseSensitive, bool allowMissingEndDelimiter, bool returnDelimiters); |
|
FixHTMLForDisplay | Replaces and and Quote characters to HTML safe equivalents. public static string FixHTMLForDisplay(string html);
|
|
FromCamelCase | Tries to create a phrase string from CamelCase text. Will place spaces before capitalized letters. public static string FromCamelCase(string camelCase);
|
|
GetProperty | Retrieves a value from an XML-like string public static string GetProperty(string propertyString,
string key); |
|
GetUrlEncodedKey | Retrieves a value by key from a UrlEncoded string. public static string GetUrlEncodedKey(string urlEncoded,
string key); |
|
Href | Create an Href HTML link public static string Href(string text,
string url, string target, string additionalMarkup); public static string Href(string url);
|
|
HtmlAbstract | Creates an Abstract from an HTML document. Strips the HTML into plain text, then creates an abstract. public static string HtmlAbstract(string html,
int length); |
|
HtmlEncode | HTML-encodes a string and returns the encoded string. public static string HtmlEncode(string text);
|
|
ImgRef | Returns an IMG link as a string. If the image is null or empty a blank string is returned. public static string ImgRef(string imageUrl,
string additionalMarkup); |
|
LogString | Simple Logging method that allows quickly writing a string to a file public static void LogString(string output,
string filename); |
|
NewStringId | Creates short string id based on a GUID hashcode. Not guaranteed to be unique across machines, but unlikely to duplicate in medium volume situations. public static string NewStringId();
|
|
NormalizeIndentation | Strips any common white space from all lines of text that have the same common white space text. Effectively removes common code indentation from code blocks for example so you can get a left aligned code snippet. public static string NormalizeIndentation(string code);
|
|
ParseDecimal | Parses an string into an decimal. If the value can't be parsed a default value is returned instead public static decimal ParseDecimal(string input,
decimal defaultValue, IFormatProvider numberFormat); |
|
ParseInt | Parses an string into an integer. If the value can't be parsed a default value is returned instead public static int ParseInt(string input,
int defaultValue, IFormatProvider numberFormat); public static int ParseInt(string input,
int defaultValue); |
|
ProperCase | Return a string in proper Case format public static string ProperCase(string Input);
|
|
ReplaceString | Replaces a substring within a string with another substring with optional case sensitivity turned off. public static string ReplaceString(string origString,
string findString, string replaceString, bool caseInsensitive); |
|
ReplaceStringInstance | String replace function that support public static string ReplaceStringInstance(string origString,
string findString, string replaceWith, int instance, bool caseInsensitive); |
|
Replicate | Replicates an input string n number of times public static string Replicate(string input,
int charCount); public static string Replicate(char character,
int charCount); |
|
SetProperty | public static string SetProperty(string propertyString,
string key, string value); |
|
SetUrlEncodedKey | Allows setting of a value in a UrlEncoded string. If the key doesn't exist a new one is set, if it exists it's replaced with the new value. public static string SetUrlEncodedKey(string urlEncoded,
string key, string value); |
|
StringToStream | Creates a Stream from a string. Internally creates a memory stream and returns that. public static Stream StringToStream(string text,
Encoding encoding); public static Stream StringToStream(string text);
|
|
StripHtml | Strips HTML tags out of an HTML string and returns just the text. public static string StripHtml(string html);
|
|
StripNonNumber | Strips all non digit values from a string and only returns the numeric string. public static string StripNonNumber(string input);
|
|
TerminateString | Terminates a string with the given end string/character, but only if the value specified doesn't already exist and the string is not empty. public static string TerminateString(string value,
string terminator); |
|
TextAbstract | Returns an abstract of the provided text by returning up to Length characters of a text string. If the text is truncated a ... is appended. public static string TextAbstract(string text,
int length); |
|
ToCamelCase | Takes a phrase and turns it into CamelCase text. White Space, punctuation and separators are stripped public static string ToCamelCase(string phrase);
|
|
TrimStart | Trims a sub string from a string public static string TrimStart(string text,
string textToTrim, bool caseInsensitive); |
|
TrimTo | Trims a string to a specific number of max characters public static string TrimTo(string value,
int charCount); |
|
UrlDecode | UrlDecodes a string without requiring System.Web public static string UrlDecode(string text);
|
|
UrlEncode | UrlEncodes a string without the requirement for System.Web public static string UrlEncode(string text);
|