C# Class Argentini.Halide.H3Text

The H3Text class contains methods and properties for manipulating and formatting strings.
Mostrar archivo Open project: argentini/Halide

Public Methods

Method Description
AutoHyperlinks ( string strVar, string param ) : String

and tags are ignored. Any linkable items within a [nolink][/nolink] or region are ignored. ]]>

AutoNoFollow ( string strVar, string param ) : String

Add rel="nofollow" property to any anchor tags in a string, so web search engines won't evaluate links and give them added weight.

CaseInsenstiveReplace ( string input, string oldValue, string newValue ) : String

A case insenstive replace method.

CompareStrings ( String source, String values, System.Boolean caseSensitive ) : System.Boolean

Compare a string to the values in a string array, returning "true" if any match.

ConvertFractions ( String text ) : String

Convert fractions like "1/3" to fancy, single-character symbolic HTML encoded fractions.

ConvertLinefeeds ( string strVar, string feedType ) : String

or

tags, except between [nofeed][/nofeed] tags. ]]>

ConvertToHtml ( string strVal, bool lineFeeds, string feedType ) : String

sequences or
tags, except between [nofeed][/nofeed] tags. URLs and domain names can be converted to true hyperLinks if specified. Use the [nolink][/nolink] tag to skip specific areas of the string when scanning for linkable text. ]]>

ConvertToHtml ( string strVal, bool lineFeeds, string feedType, bool hyperLinks, string linkParams ) : String

sequences or
tags, except between [nofeed][/nofeed] tags. URLs and domain names can be converted to true hyperLinks if specified. Use the [nolink][/nolink] tag to skip specific areas of the string when scanning for linkable text. ]]>

Crop ( string strVar, int xNumber, CropType cropType ) : String

Return the current string cropped by number of words or characters.

Words: returns the first "xNumber" of words in the string, including any intermediate punctuation, etc. Trailing punctuation is always removed.

Characters: returns the first "xNumber" of characters in the string, including any intermediate punctuation, etc. When it locates the last character, it scans ahead to make sure it's not breaking a word. If it is in the middle of a word, it will skip ahead to the next non-alpha-numeric chatacter and break on that, so your cropped string may be slightly larger than the number of characters you requested. Trailing punctuation is always removed.

Crop ( string strVar, int xNumber, CropType cropType, string xChars ) : String

Return the current string cropped by number of words or characters.

Words: returns the first "xNumber" of words in the string, including any intermediate punctuation, etc. Trailing punctuation is always removed.

Characters: returns the first "xNumber" of characters in the string, including any intermediate punctuation, etc. When it locates the last character, it scans ahead to make sure it's not breaking a word. If it is in the middle of a word, it will skip ahead to the next non-alpha-numeric chatacter and break on that, so your cropped string may be slightly larger than the number of characters you requested. Trailing punctuation is always removed.

Crop ( string strVar, int xNumber, CropType cropType, string xChars, string endWhenCropped ) : String

Return the current string cropped by number of words or characters.

Words: returns the first "xNumber" of words in the string, including any intermediate punctuation, etc. Trailing punctuation is always removed.

Characters: returns the first "xNumber" of characters in the string, including any intermediate punctuation, etc. When it locates the last character, it scans ahead to make sure it's not breaking a word. If it is in the middle of a word, it will skip ahead to the next non-alpha-numeric chatacter and break on that, so your cropped string may be slightly larger than the number of characters you requested. Trailing punctuation is always removed.

FilterWords ( string input ) : String

Removes all the words passed in the filter words parameters. The replace is NOT case sensitive.

FilterWords ( string input, char mask ) : String

Removes all the words passed in the filter words parameters. The replace is NOT case sensitive.

FixNull ( string strVar ) : String

Fixes null string variable references.

FormatNumber ( System.Int64 value, NumberFormats format ) : String

Formats a number for output.

FormatNumber ( string value, NumberFormats format ) : String

Formats a number for output.

FormatPercentage ( int value, int total, int places ) : String

Generates a percentage, formatted with "places" decimal places.

FormatTelephoneNumber ( string phoneNumber, TelephoneFormat telephoneFormat ) : String

Formats a telephone number. For U.S. 10-digit numbers, if a leading "1" is included, it is stripped prior to formatting.

GenerateUniqueString ( ) : String

Creates a unique, cryptic text string (based on GUID) for use in cookies, and more.

HasWords ( string input ) : MatchCollection

Checks the passed string to see if it has any of the passed words; not case-sensitive.

HtmlDecodeSymbols ( string sourceString ) : String

HtmlEncode ( string text ) : String

Fully encode a string for use on a URL, within a mailto link. In a basic sense, it encodes text using HttpUtility.UrlEncode, but then further converts "+" symbols to "%20".

HtmlEncodeSymbols ( string sourceString ) : String

HtmlRemoveSymbols ( string sourceString ) : String

Remove all occurrences of HTML-friendly escape sequences (entities).

InStr ( int start, string string1, string string2 ) : Int32

Clone of the ASP InStr function. Finds the starting location of a substring.

InStr ( string string1, string string2 ) : Int32

Clone of the ASP InStr function. Finds the starting location of a substring.

Left ( string stringData, int i ) : String

Return the leftmost "i" characters from string, or "" if invalid length is passed.

MakeLink ( string strVal, string url ) : String

style link, based on passed parameters. ]]>

MakeLink ( string strVal, string url, string title ) : String

style link, based on passed parameters. ]]>

MakeLink ( string strVal, string url, string title, string target, string className ) : String

style link, based on passed parameters. ]]>

Mid ( string stringData, int startIndex ) : String

Return a substring from a specific character posiiton in the string, to the end of the string.

Mid ( string stringData, int startIndex, int length ) : String

Return a substring, or "" if invalid params are passed.

ReplaceFirst ( string input, string oldValue, string newValue ) : String

Replaces the first occurrence of a string with the replacement value. The Replace is case senstive.

ReplaceLast ( string input, string oldValue, string newValue ) : String

Replaces the last occurrence of a string with the replacement value. The replace is case senstive.

Right ( string stringData, int i ) : String

Return the rightmost "i" characters from string, or "" if invalid length is passed.

Right ( string stringData, string marker ) : String

Return the rightmost characters from string up to the first occurrence of "Marker".

SanitizeEscapes ( string strVar ) : String

Return the current string with all escape sequences (e.g. ") changed to appropriate and ASCII characters (e.g. "), so dangerous markup can more easily be identified.

SentenceCase ( string input ) : String

Converts a string to sentence case.

SmartNav ( string classString, string urlString, int recordCount, int perPage, int currentPage, string elipses ) : String

Returns HTML in a string for a flickr-style button navigation. "classString" controls the name of the surrounding DIV tag, so the style sheet can be customized and assigned to the SmartNav.

SmartNav ( string classString, string urlString, int recordCount, int perPage, int currentPage, string elipses, bool showPreviousNext, string prevText, string nextText, int buttonCount ) : String

Returns HTML in a string for a flickr-style button navigation. "classString" controls the name of the surrounding DIV tag, so the style sheet can be customized and assigned to the SmartNav.

SmartNav ( string classString, string urlString, int recordCount, int perPage, int currentPage, string elipses, bool showPreviousNext, string prevText, string nextText, int buttonCount, System.Boolean leftToRight ) : String

Returns HTML in a string for a flickr-style button navigation. "classString" controls the name of the surrounding DIV tag, so the style sheet can be customized and assigned to the SmartNav.

SqlSuperSanitize ( string strVar ) : String

to \r\n\r\n and
to \r\n sequences. Also replaces single apostrophes with two apostrophes. ]]>

StrToByteArray ( string str ) : byte[]

Convert a string to a byte array.

StripDangerousProperties ( string strVar ) : String

Remove all occurrences of dangerous tag properties from a string. Helps to prevent injected javascript from running, etc.

StripEmailHeaderProperties ( string strVar ) : String

Remove all occurrences of dangerous email header properties from a string. This is used to prevent someone from inserting code into submitted form data that will trick the page into sending mail to other people.

E-mail header text that will be removed includes:

"x-mailer:", "x-rcpt-to:", "x-uidl:", "content-transfer-encoding:", "content-type:", "mime-version:", "x-sender:", "bcc:", "cc:", "x-receiver:"

StripHtml ( string strVar, bool convertBreaks, bool keepLinks ) : String

Return the current string with HTML tags removed.

StripScripts ( string strVar ) : String

Return the current string with potentially dangerous script tags removed. Dangerous scriptable tags that are removed include:

applet, body, embed, frame, script, frameset, html, iframe, img, style, layer, link, ilayer, meta, object.

javascript properties injected into other tags are also removed.

StripSpecificTag ( string strVar, string tagName ) : String

Return the current string with all instances of a specific tag removed.

SubStringCount ( string src, char find ) : Int32

Returns the number of times a character or substring occurs within a string.

SubStringCount ( string src, string find ) : Int32

Returns the number of times a character or substring occurs within a string.

SuperSanitize ( string strVar ) : String

to \r\n\r\n and
to \r\n sequences. ]]>

TitleCase ( string input ) : String

Converts a string to title case.

TitleCase ( string input, bool ignoreShortWords ) : String

Converts a string to title case.

Trim ( String sourceString ) : String

Trim leading and trailing white space from a string, including line breaks, em's, en's, tabs, etc.

TrimIntraWords ( string input ) : String

Removes multiple spaces between words.

UnFormatFileSize ( string fileSize ) : Decimal

Converts a file size string into a number of equivalent bytes. Used to convert strings like "115KB" to a number or actual bytes.

UrlRewriteText ( string input ) : String

Creates a URL-compatible string from plain text. Ideal for use with URL rewriting when you want to link to an article based on its headline text, and not a cryptic path like "pagename.aspx?ID=1234". Replaces any number of sequential non-alphanumeric characters with a single hyphen character. The returned string will have all leading and trailing hyphens stripped as well.

For example, "(Now is the time, I swear.)" becomes "Now-is-the-time-I-swear"

WordWrap ( string input, int charCount ) : String

Wraps the passed string up until the next whitespace on or after the total charCount has been reached for that line. Uses the environment new line symbol for the break text.

WordWrap ( string input, int charCount, bool cutOff ) : String

Wraps the passed string up until the total number of characters (if cuttOff is true) or until the next whitespace (if cutOff is false). Uses the environment new line symbol for the break text.

WordWrap ( string input, int charCount, bool cutOff, string breakText ) : String

Wraps the passed string at a given character count per line (if cuttOff is true) or until the next whitespace after the given length (if cutOff is false). Uses the passed breakText for lineBreaks.

Private Methods

Method Description
H3Text ( ) : System

Method Details

AutoHyperlinks() public static method

and tags are ignored. Any linkable items within a [nolink][/nolink] or region are ignored. ]]>
public static AutoHyperlinks ( string strVar, string param ) : String
strVar string String to process.
param string /// tags, like target="_blank". /// ]]> ///
return String

AutoNoFollow() public static method

Add rel="nofollow" property to any anchor tags in a string, so web search engines won't evaluate links and give them added weight.
public static AutoNoFollow ( string strVar, string param ) : String
strVar string String to process.
param string Additional params to add to the link, like target="_blank".
return String

CaseInsenstiveReplace() public static method

A case insenstive replace method.
public static CaseInsenstiveReplace ( string input, string oldValue, string newValue ) : String
input string The string to examine.
oldValue string The value to replace.
newValue string The new value to be inserted.
return String

CompareStrings() public static method

Compare a string to the values in a string array, returning "true" if any match.
public static CompareStrings ( String source, String values, System.Boolean caseSensitive ) : System.Boolean
source String String to compare against.
values String String array of values to compare.
caseSensitive System.Boolean Evaluate equality based on case, or not.
return System.Boolean

ConvertFractions() public static method

Convert fractions like "1/3" to fancy, single-character symbolic HTML encoded fractions.
public static ConvertFractions ( String text ) : String
text String Text to process
return String

ConvertLinefeeds() public static method

or

tags, except between [nofeed][/nofeed] tags. ]]>
public static ConvertLinefeeds ( string strVar, string feedType ) : String
strVar string String to convert.
feedType string /// " or "

". /// ]]> ///

return String

ConvertToHtml() public static method

sequences or
tags, except between [nofeed][/nofeed] tags. URLs and domain names can be converted to true hyperLinks if specified. Use the [nolink][/nolink] tag to skip specific areas of the string when scanning for linkable text. ]]>
public static ConvertToHtml ( string strVal, bool lineFeeds, string feedType ) : String
strVal string Text to process.
lineFeeds bool Convert lineFeeds to HTML equivalents (true or false).
feedType string /// " or "
". /// ]]> ///
return String

ConvertToHtml() public static method

sequences or
tags, except between [nofeed][/nofeed] tags. URLs and domain names can be converted to true hyperLinks if specified. Use the [nolink][/nolink] tag to skip specific areas of the string when scanning for linkable text. ]]>
public static ConvertToHtml ( string strVal, bool lineFeeds, string feedType, bool hyperLinks, string linkParams ) : String
strVal string Text to process.
lineFeeds bool Convert lineFeeds to HTML equivalents (true or false).
feedType string /// " or "
". /// ]]> ///
hyperLinks bool Convert urls and domain names to hyperLinks (true or false).
linkParams string If converting urls and domain names to hyperLinks, add these params to the anchor tags.
return String

Crop() public static method

Return the current string cropped by number of words or characters.

Words: returns the first "xNumber" of words in the string, including any intermediate punctuation, etc. Trailing punctuation is always removed.

Characters: returns the first "xNumber" of characters in the string, including any intermediate punctuation, etc. When it locates the last character, it scans ahead to make sure it's not breaking a word. If it is in the middle of a word, it will skip ahead to the next non-alpha-numeric chatacter and break on that, so your cropped string may be slightly larger than the number of characters you requested. Trailing punctuation is always removed.

public static Crop ( string strVar, int xNumber, CropType cropType ) : String
strVar string String to process.
xNumber int Number of words or characters to return (as close as possible).
cropType CropType Enum value: CropType.Characters or CropType.Words.
return String

Crop() public static method

Return the current string cropped by number of words or characters.

Words: returns the first "xNumber" of words in the string, including any intermediate punctuation, etc. Trailing punctuation is always removed.

Characters: returns the first "xNumber" of characters in the string, including any intermediate punctuation, etc. When it locates the last character, it scans ahead to make sure it's not breaking a word. If it is in the middle of a word, it will skip ahead to the next non-alpha-numeric chatacter and break on that, so your cropped string may be slightly larger than the number of characters you requested. Trailing punctuation is always removed.

public static Crop ( string strVar, int xNumber, CropType cropType, string xChars ) : String
strVar string String to process.
xNumber int Number of words or characters to return (as close as possible).
cropType CropType Enum value: CropType.Characters or CropType.Words.
xChars string Valid characters to break on (defaults to space characters).
return String

Crop() public static method

Return the current string cropped by number of words or characters.

Words: returns the first "xNumber" of words in the string, including any intermediate punctuation, etc. Trailing punctuation is always removed.

Characters: returns the first "xNumber" of characters in the string, including any intermediate punctuation, etc. When it locates the last character, it scans ahead to make sure it's not breaking a word. If it is in the middle of a word, it will skip ahead to the next non-alpha-numeric chatacter and break on that, so your cropped string may be slightly larger than the number of characters you requested. Trailing punctuation is always removed.

public static Crop ( string strVar, int xNumber, CropType cropType, string xChars, string endWhenCropped ) : String
strVar string String to process.
xNumber int Number of words or characters (as close as possible) to return.
cropType CropType Enum value: CropType.Characters or CropType.Words.
xChars string Valid characters on which to break (defaults to space characters).
endWhenCropped string String to append to the return value, only if the string had to be cropped.
return String

FilterWords() public static method

Removes all the words passed in the filter words parameters. The replace is NOT case sensitive.
public static FilterWords ( string input ) : String
input string The string to search.
return String

FilterWords() public static method

Removes all the words passed in the filter words parameters. The replace is NOT case sensitive.
public static FilterWords ( string input, char mask ) : String
input string The string to search.
mask char A character that is inserted for each letter of the replaced word.
return String

FixNull() public static method

Fixes null string variable references.
public static FixNull ( string strVar ) : String
strVar string String variable to fix.
return String

FormatNumber() public static method

Formats a number for output.
public static FormatNumber ( System.Int64 value, NumberFormats format ) : String
value System.Int64 Numeric value to format.
format NumberFormats Enumeration with preset number formats.
return String

FormatNumber() public static method

Formats a number for output.
public static FormatNumber ( string value, NumberFormats format ) : String
value string Numeric value to format.
format NumberFormats Enumeration with preset number formats.
return String

FormatPercentage() public static method

Generates a percentage, formatted with "places" decimal places.
public static FormatPercentage ( int value, int total, int places ) : String
value int Value for which a percentage is needed.
total int Total of all values from which to generate a percentage /// (divided by "value" parameter).
places int Number of decimal places to return in the percentage string.
return String

FormatTelephoneNumber() public static method

Formats a telephone number. For U.S. 10-digit numbers, if a leading "1" is included, it is stripped prior to formatting.
public static FormatTelephoneNumber ( string phoneNumber, TelephoneFormat telephoneFormat ) : String
phoneNumber string The phone number.
telephoneFormat TelephoneFormat TelephoneFormat constant which defines how the telephone number should be formatted.
return String

GenerateUniqueString() public static method

Creates a unique, cryptic text string (based on GUID) for use in cookies, and more.
public static GenerateUniqueString ( ) : String
return String

HasWords() public static method

Checks the passed string to see if it has any of the passed words; not case-sensitive.
public static HasWords ( string input ) : MatchCollection
input string The string to check.
return System.Text.RegularExpressions.MatchCollection

HtmlDecodeSymbols() public static method

public static HtmlDecodeSymbols ( string sourceString ) : String
sourceString string String to filter.
return String

HtmlEncode() public static method

Fully encode a string for use on a URL, within a mailto link. In a basic sense, it encodes text using HttpUtility.UrlEncode, but then further converts "+" symbols to "%20".
public static HtmlEncode ( string text ) : String
text string Text value to encode.
return String

HtmlEncodeSymbols() public static method

public static HtmlEncodeSymbols ( string sourceString ) : String
sourceString string String to filter.
return String

HtmlRemoveSymbols() public static method

Remove all occurrences of HTML-friendly escape sequences (entities).
public static HtmlRemoveSymbols ( string sourceString ) : String
sourceString string String to filter.
return String

InStr() public static method

Clone of the ASP InStr function. Finds the starting location of a substring.
public static InStr ( int start, string string1, string string2 ) : Int32
start int Starting character position (1 is first character).
string1 string Source string.
string2 string Search string.
return System.Int32

InStr() public static method

Clone of the ASP InStr function. Finds the starting location of a substring.
public static InStr ( string string1, string string2 ) : Int32
string1 string Source string.
string2 string Search string.
return System.Int32

Left() public static method

Return the leftmost "i" characters from string, or "" if invalid length is passed.
public static Left ( string stringData, int i ) : String
stringData string String to process.
i int Number of characters to return.
return String

MakeLink() public static method

style link, based on passed parameters. ]]>
public static MakeLink ( string strVal, string url ) : String
strVal string Text to make into a link (text to wrap with anchor tags).
url string URL to which the link should point.
return String

MakeLink() public static method

style link, based on passed parameters. ]]>
public static MakeLink ( string strVal, string url, string title ) : String
strVal string Text to make into a link (text to wrap with anchor tags).
url string URL to which the link should point.
title string Text for the "title" and "alt" properties of the anchor tag.
return String

MakeLink() public static method

style link, based on passed parameters. ]]>
public static MakeLink ( string strVal, string url, string title, string target, string className ) : String
strVal string Text to make into a link (text to wrap with anchor tags).
url string URL to which the link should point.
title string Text for the "title" and "alt" properties of the anchor tag.
target string Destination for the "target" property of the anchor tag.
className string Class name with which to style the anchor tag.
return String

Mid() public static method

Return a substring from a specific character posiiton in the string, to the end of the string.
public static Mid ( string stringData, int startIndex ) : String
stringData string String to process.
startIndex int Substring begins at this character position, to the end of the string.
return String

Mid() public static method

Return a substring, or "" if invalid params are passed.
public static Mid ( string stringData, int startIndex, int length ) : String
stringData string String to process.
startIndex int Substring begins at this character position.
length int Substring is this many characters.
return String

ReplaceFirst() public static method

Replaces the first occurrence of a string with the replacement value. The Replace is case senstive.
public static ReplaceFirst ( string input, string oldValue, string newValue ) : String
input string The string to examine.
oldValue string The value to replace.
newValue string the new value to be inserted.
return String

ReplaceLast() public static method

Replaces the last occurrence of a string with the replacement value. The replace is case senstive.
public static ReplaceLast ( string input, string oldValue, string newValue ) : String
input string The string to examine.
oldValue string The value to replace.
newValue string the new value to be inserted.
return String

Right() public static method

Return the rightmost "i" characters from string, or "" if invalid length is passed.
public static Right ( string stringData, int i ) : String
stringData string String to process.
i int Number of characters to return.
return String

Right() public static method

Return the rightmost characters from string up to the first occurrence of "Marker".
public static Right ( string stringData, string marker ) : String
stringData string String to process.
marker string Substring to use to truncate right side of string.
return String

SanitizeEscapes() public static method

Return the current string with all escape sequences (e.g. ") changed to appropriate and ASCII characters (e.g. "), so dangerous markup can more easily be identified.
public static SanitizeEscapes ( string strVar ) : String
strVar string String to process.
return String

SentenceCase() public static method

Converts a string to sentence case.
public static SentenceCase ( string input ) : String
input string The string to convert.
return String

SmartNav() public static method

Returns HTML in a string for a flickr-style button navigation. "classString" controls the name of the surrounding DIV tag, so the style sheet can be customized and assigned to the SmartNav.
public static SmartNav ( string classString, string urlString, int recordCount, int perPage, int currentPage, string elipses ) : String
classString string Name of the surrounding DIV tag so style sheet can customized.
urlString string Base url for navigating pages. Page number is appended to the end of this for links.
recordCount int Number of total records in the database. Used to calculate page count.
perPage int Number of total records listed per page. Used to calculate page count.
currentPage int Current page number.
elipses string Text or HTML to show between button segments (e.g. " ... ").
return String

SmartNav() public static method

Returns HTML in a string for a flickr-style button navigation. "classString" controls the name of the surrounding DIV tag, so the style sheet can be customized and assigned to the SmartNav.
public static SmartNav ( string classString, string urlString, int recordCount, int perPage, int currentPage, string elipses, bool showPreviousNext, string prevText, string nextText, int buttonCount ) : String
classString string Name of the surrounding DIV tag so style sheet can customized.
urlString string Base url for navigating pages. Page number is appended to the end of this for links.
recordCount int Number of total records in the database. Used to calculate page count.
perPage int Number of total records listed per page. Used to calculate page count.
currentPage int Current page number.
elipses string Text or HTML to show between button segments (e.g. " ... ").
showPreviousNext bool true, show "Previous" and "Next" buttons; false, do not.
prevText string Text for the previous page button.
nextText string Text for the next page button.
buttonCount int How many buttons to show without breaking up the nav (values 6 and up).
return String

SmartNav() public static method

Returns HTML in a string for a flickr-style button navigation. "classString" controls the name of the surrounding DIV tag, so the style sheet can be customized and assigned to the SmartNav.
public static SmartNav ( string classString, string urlString, int recordCount, int perPage, int currentPage, string elipses, bool showPreviousNext, string prevText, string nextText, int buttonCount, System.Boolean leftToRight ) : String
classString string Name of the surrounding DIV tag so style sheet can customized.
urlString string Base url for navigating pages. Page number is appended to the end of this for links.
recordCount int Number of total records in the database. Used to calculate page count.
perPage int Number of total records listed per page. Used to calculate page count.
currentPage int Current page number.
elipses string Text or HTML to show between button segments (e.g. " ... ").
showPreviousNext bool true, show "Previous" and "Next" buttons; false, do not.
prevText string Text for the previous page button.
nextText string Text for the next page button.
buttonCount int How many buttons to show without breaking up the nav (values 6 and up).
leftToRight System.Boolean Left to Right layoutto left.
return String

SqlSuperSanitize() public static method

to \r\n\r\n and
to \r\n sequences. Also replaces single apostrophes with two apostrophes. ]]>
public static SqlSuperSanitize ( string strVar ) : String
strVar string String to sanitize.
return String

StrToByteArray() public static method

Convert a string to a byte array.
public static StrToByteArray ( string str ) : byte[]
str string String to convert to a byte array.
return byte[]

StripDangerousProperties() public static method

Remove all occurrences of dangerous tag properties from a string. Helps to prevent injected javascript from running, etc.
public static StripDangerousProperties ( string strVar ) : String
strVar string String to process.
return String

StripEmailHeaderProperties() public static method

Remove all occurrences of dangerous email header properties from a string. This is used to prevent someone from inserting code into submitted form data that will trick the page into sending mail to other people.

E-mail header text that will be removed includes:

"x-mailer:", "x-rcpt-to:", "x-uidl:", "content-transfer-encoding:", "content-type:", "mime-version:", "x-sender:", "bcc:", "cc:", "x-receiver:"

public static StripEmailHeaderProperties ( string strVar ) : String
strVar string String to process.
return String

StripHtml() public static method

Return the current string with HTML tags removed.
public static StripHtml ( string strVar, bool convertBreaks, bool keepLinks ) : String
strVar string String to process.
convertBreaks bool /// " and "
" to \r\n and converts "

" to \r\n\r\n. /// ]]> ///
keepLinks bool Keep and anchor tags intact.
return String

StripScripts() public static method

Return the current string with potentially dangerous script tags removed. Dangerous scriptable tags that are removed include:

applet, body, embed, frame, script, frameset, html, iframe, img, style, layer, link, ilayer, meta, object.

javascript properties injected into other tags are also removed.

public static StripScripts ( string strVar ) : String
strVar string String to process.
return String

StripSpecificTag() public static method

Return the current string with all instances of a specific tag removed.
public static StripSpecificTag ( string strVar, string tagName ) : String
strVar string String to process.
tagName string Tag name to strip (e.g. blockquote)
return String

SubStringCount() public static method

Returns the number of times a character or substring occurs within a string.
public static SubStringCount ( string src, char find ) : Int32
src string String to search.
find char Character to count.
return System.Int32

SubStringCount() public static method

Returns the number of times a character or substring occurs within a string.
public static SubStringCount ( string src, string find ) : Int32
src string String to search.
find string Substring to count.
return System.Int32

SuperSanitize() public static method

to \r\n\r\n and
to \r\n sequences. ]]>
public static SuperSanitize ( string strVar ) : String
strVar string String to sanitize.
return String

TitleCase() public static method

Converts a string to title case.
public static TitleCase ( string input ) : String
input string The string to convert.
return String

TitleCase() public static method

Converts a string to title case.
public static TitleCase ( string input, bool ignoreShortWords ) : String
input string The string to convert.
ignoreShortWords bool If true, does not capitalize the most common 70 prepositions.
return String

Trim() public static method

Trim leading and trailing white space from a string, including line breaks, em's, en's, tabs, etc.
public static Trim ( String sourceString ) : String
sourceString String String to trim.
return String

TrimIntraWords() public static method

Removes multiple spaces between words.
public static TrimIntraWords ( string input ) : String
input string The string to trim.
return String

UnFormatFileSize() public static method

Converts a file size string into a number of equivalent bytes. Used to convert strings like "115KB" to a number or actual bytes.
public static UnFormatFileSize ( string fileSize ) : Decimal
fileSize string String file size to convert to a number of bytes /// (e.g. "103kb", "15 MB", "1TB", "37.6GB", et al.).
return Decimal

UrlRewriteText() public static method

Creates a URL-compatible string from plain text. Ideal for use with URL rewriting when you want to link to an article based on its headline text, and not a cryptic path like "pagename.aspx?ID=1234". Replaces any number of sequential non-alphanumeric characters with a single hyphen character. The returned string will have all leading and trailing hyphens stripped as well.

For example, "(Now is the time, I swear.)" becomes "Now-is-the-time-I-swear"

public static UrlRewriteText ( string input ) : String
input string The string to process (usually a subject or headline).
return String

WordWrap() public static method

Wraps the passed string up until the next whitespace on or after the total charCount has been reached for that line. Uses the environment new line symbol for the break text.
public static WordWrap ( string input, int charCount ) : String
input string The string to wrap.
charCount int The number of characters per line.
return String

WordWrap() public static method

Wraps the passed string up until the total number of characters (if cuttOff is true) or until the next whitespace (if cutOff is false). Uses the environment new line symbol for the break text.
public static WordWrap ( string input, int charCount, bool cutOff ) : String
input string The string to wrap.
charCount int The number of characters per line.
cutOff bool If true, will break in the middle of a word.
return String

WordWrap() public static method

Wraps the passed string at a given character count per line (if cuttOff is true) or until the next whitespace after the given length (if cutOff is false). Uses the passed breakText for lineBreaks.
public static WordWrap ( string input, int charCount, bool cutOff, string breakText ) : String
input string The string to wrap.
charCount int The number of characters per line.
cutOff bool If true, will break in the middle of a word.
breakText string The line break text to use.
return String