| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

String

Page history last edited by PBworks 17 years, 12 months ago


 

String

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

The trimmed String.

 

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

The cropped String.

 

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

The modified new String.

 

comments

Replaces the match(es) with "" (empty String).


String.removeTags()

 

returns

A copy of the String with all HTML markup removed.

 

comments

Removes all the HTML markup from the String.


String.toCamelCase()

 

returns

The altered String.

 

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.