C# Class Upac.Core.Utilities.StringUtil

Show file Open project: 1508/upac-for-umbraco

Public Methods

Method Description
Clip ( string text, int maxLength, bool ellipsis ) : string
Left ( string text, int length ) : string
Mid ( string text, int start ) : string
NbspToSpace ( string input ) : string

Converts all HTML non-breaking spaces to normal space

NewLineToBreak ( string input ) : string

Converts new line(\n) and carriage return(\r) symbols to HTML line breaks.

RemoveMultipleSpaces ( string input ) : string

Removes multiple spaces between words

RemoveNewLines ( string input ) : string

Removes the new line (\n) and carriage return (\r) symbols.

RemoveNewLines ( string input, bool addSpace ) : string

Removes the new line (\n) and carriage return (\r) symbols.

SpaceToNbsp ( string input ) : string

Converts all spaces to HTML non-breaking spaces

Split ( string text, string delimiter, bool trim ) : string[]
WordWrap ( string input, int charCount ) : string

Wraps the passed string at the at 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 at the total number of characters (if cuttOff is true) or at 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 the total number of characters (if cuttOff is true) or at the next whitespace (if cutOff is false). Uses the passed breakText for lineBreaks.

Method Details

Clip() public static method

public static Clip ( string text, int maxLength, bool ellipsis ) : string
text string
maxLength int
ellipsis bool
return string

Left() public static method

public static Left ( string text, int length ) : string
text string
length int
return string

Mid() public static method

public static Mid ( string text, int start ) : string
text string
start int
return string

NbspToSpace() public static method

Converts all HTML non-breaking spaces to normal space
public static NbspToSpace ( string input ) : string
input string The string to convert.
return string

NewLineToBreak() public static method

Converts new line(\n) and carriage return(\r) symbols to HTML line breaks.
public static NewLineToBreak ( string input ) : string
input string The string to convert.
return string

RemoveMultipleSpaces() public static method

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

RemoveNewLines() public static method

Removes the new line (\n) and carriage return (\r) symbols.
public static RemoveNewLines ( string input ) : string
input string The string to search.
return string

RemoveNewLines() public static method

Removes the new line (\n) and carriage return (\r) symbols.
public static RemoveNewLines ( string input, bool addSpace ) : string
input string The string to search.
addSpace bool If true, adds a space /// (" ") for each newline and carriage /// return found.
return string

SpaceToNbsp() public static method

Converts all spaces to HTML non-breaking spaces
public static SpaceToNbsp ( string input ) : string
input string The string to convert.
return string

Split() public static method

public static Split ( string text, string delimiter, bool trim ) : string[]
text string
delimiter string
trim bool
return string[]

WordWrap() public static method

Wraps the passed string at the at 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 at the total number of characters (if cuttOff is true) or at 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 the total number of characters (if cuttOff is true) or at the next whitespace (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