StringExtensions Members
The StringExtensions type exposes the following members.
Methods
| Name | Description | |
|---|---|---|
|
|
Escape |
Escapes the specified string in a compatible format with the Javascript escape method.
|
|
|
HTMLDecode |
Writes the string through an HtmlTextWriter, which processes HTML entities.
|
|
|
HTMLEncode |
HTML-encodes the string, converting special characters to their HTML entity equivalents.
|
|
|
IsGuid |
Determines whether the string is a valid GUID format.
|
|
|
JavaScriptDeserialize |
Deserializes a JavaScript-escaped string back to its original form.
Wraps the input in quotes if not already present before deserializing.
|
|
|
JavaScriptSerialize |
Serializes the string using the JavaScript serializer, escaping special characters for safe embedding in JavaScript.
The surrounding quotes are removed from the result.
|
|
|
Left |
Returns the left part of this string instance.
|
|
|
ReplaceFirst |
A string extension method that replace first occurence.
|
|
|
Right |
Returns the right part of the string instance.
|
|
|
SafeString |
Returns the string value, or String if the string is null.
|
|
|
Shorten(String, Int32, Boolean) |
Gets a Shortened version of a string
|
|
|
Shorten(String, Int32, Boolean, Boolean%) |
Gets a Shortened version of a string
|
|
|
StripHTML |
Removes all HTML tags from the string, returning only the text content.
|
|
|
ToAlphaNumeric |
Removes all non-alphanumeric characters except spaces and hyphens from the string.
|
|
|
ToCamelCase |
Inserts spaces into a PascalCase or camelCase string to produce human-readable text.
|
|
|
ToDateTime |
Parses the string as a DateTime, returning null if the string is empty or invalid.
|
|
|
ToDouble |
Parses the string as a double, returning the specified default value if parsing fails.
|
|
|
ToGuid |
Parses the string as a Guid, returning null if the string is empty or invalid.
|
|
|
ToInteger |
Parses the object as an integer, returning the specified default value if parsing fails.
Handles enum values, strings, and other objects via ToString().
|
|
|
ToLineBreakToHtml |
Replaces environment newline characters with HTML line break tags.
|
|
|
ToSpaceToHtml |
Replaces space characters with HTML non-breaking space entities.
|
|
|
ToTabToHtml |
Replaces tab characters with HTML non-breaking space entities (4 spaces per tab).
|
|
|
TrimPunctuation |
Removes trailing punctuation characters from the end of the string.
|
|
|
TrimWhiteSpace |
Trims whitespace characters including carriage returns, newlines, form feeds, tabs, and vertical tabs.
|
|
|
Unscape |
Unescapes the specified string in a compatible format with the Javascript escape method.
|
|
|
UrlFriendly |
Creates a string that is Url-friendly.
|

