Object Summary
prototype add-ons to String.
When a String needs to be trimmed, or when HTML tags in it is going to be removed, these prototype additions can be used.
Methods
String.trim(blnIgnoreCarriage,blnIgnoreInnerWhiteSpace)
parameters
blnIgnoreCarriage - If true, any (new line) character is discarded. (defaults to false if parameter is null or not supplied)
blnIgnoreInnerWhiteSpace - If true, the inner multiple whitespace characters are not trimmed. If false they are trimmed as well. (defaults to false if parameter is null or not supplied)
returns
comments
Trims leading, trailing an multiple inner whitespace characters of the String
String.removeExcess(intLen,strPostFix)
parameters
intLen - Maximum allowed length.
strPostFix - The String to add to the end if length of the String exceeds intLen.
returns
comments
The default values of intLen and strPostFix are 50 and "..." respectively.
If the length of the String is greater than or equal to intLen, right side of the String is cropped and a postfix is appended to it to indicate that the String is not fully complete.
If the length is less than intLen the String is untouched and returned as it is.
String.remove(varRegExp,strOption)
parameters
varRegExp - The regular expression object to test. If given as a String, it is converted to a RegExp.
strOption - (Optional) If varRegExp is supplied as a String, the parameter denotes the option values. It can be "g", "i", or "ig" meaning "global", "ignore case", "global - ignore case" respectively.
If not supplied "g" is assumed as a default value.
returns
comments
Replaces the match(es) with "" (empty String).
String.removeTags()
returns
A copy of the String with all HTML markup removed.
comments
String.toCamelCase()
returns
comments
Converts a hypenated string (i.e. background-color-test) to a camelCase version (i.e. backgroundColorTest)
See Also
None given.
Usage Examples
Comments (0)
You don't have permission to comment on this page.