StringParse (StringParse)

StringParse

class StringParse

The StringParse class is a collection of string functions that alter a string or return relevant information on it.

Method summary

Method Description

replace
(search:String, replacer:String, text:String) : String
Replaces all instances of a string within a string.

randomChars
(length:uint, charset:String, chars:*, exclude:*) :String
Outputs X random characters.

ucwords
(text:String) : String
Returns a string with the first character of each word capitalized.

reverse
(text:String) : String
Reverses the characters of a string.

isin
(search:String, text:String, cs:Boolean) : Boolean
Searches a string.

replace(search:String, replacer:String, text:String): String

Usage

StringParse.replace('box', 'race', 'boxcar');

Parameters

search:String
- The string to replace

replacer:String
- The string insert

text:String
- The original text

Returns

String

Description

Replaces all instances of a string within a string.


randomChars(length:uint, charset:String, chars:*,exclude:*) : String

Usage

StringParse.randomChars(32,'alphaNumeric','ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz','123');

Parameters

length:uint
- Number Number of random letters to return;

charset:String
- Character set to pull from [alphaNumeric, numeric, alpha, all]

chars:*
- [String|Array] List of characters to include

exclude:*
- [String|Array] List of characters to exclude

Returns

String

Description

Outputs X random characters.


ucwords(text:String) : String

Usage

StringParse.ucwords('the quick brown fox jumps over the fence');

Parameters

text:String
- The String to parse

Returns

String

Description

Returns a string with the first character of each word capitalized.


reverse(text:String) : String

Usage

StringParse.reverse('olleh');

Parameters

text:String
- The String to parse

Returns

String

Description

Reverses the characters of a string.


isin(search:String, text:String, cs:Boolean) :Boolean

Usage

StringParse.isin('man', 'spaceman', true)

Parameters

search:String
- The String to find

text:String
- The String to search

cs:Boolean
- Whether the search is case sensative

Returns

Boolean

Description

Searches a string.



You must be logged in to post a comment.