## String

    Object
       |
       +--String

SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods

Properties Summary
`Object` | `clip`
`<static> Object` | `ANUMPATTERN`
`<static> Object` | `APATTERN`
`<static> Object` | `BALANCE`
`<static> Object` | `EMAILPATTERN`
`<static> Object` | `FILEPATTERN`
`<static> Object` | `HEXPATTERN`
`<static> Object` | `ISOFORMAT`
`<static> Object` | `LEFT`
`<static> Object` | `NULL`
`<static> Object` | `NUMPATTERN`
`<static> Object` | `RIGHT`
`<static> Object` | `URLPATTERN`

Methods Summary
`Object` | `capitalize(limit)` transforms the first n characters of a string to uppercase
`Object` | `contains(str, fromIndex)` function returns true if a string contains the string passed as argument
`Object` | `count(str)` returns the amount of occurences of one string in another
`Object` | `debase64()` returns the decoded string using the base64 algorithm
`Object` | `diff(mod, separator)` function compares a string with the one passed as argument using diff
`Object` | `embody(limit, clipping, delimiter)` breaks up a string into two parts called head and tail at the given position don't apply this to HTML, i.e.
`Object` | `enbase64()` returns the string encoded using the base64 algorithm
`Object` | `encode()`
`Object` | `encodeForm()`
`Object` | `encodeXml()`
`Object` | `endsWith(str)` function returns true if the string ends with the string passed as argument
`Object` | `entitize()` translates all characters of a string into HTML entities
`Object` | `format()`
`Object` | `group(interval, str, ignoreWhiteSpace)` function inserts a string every number of characters
`Object` | `head(limit, clipping, delimiter)` get the head of a string
`Object` | `isAlpha()` function returns true if the string contains only characters a-z
`Object` | `isAlphanumeric()` function returns true if the string contains only a-z and 0-9 (case insensitive!)
`Object` | `isDateFormat()` checks if a date format pattern is correct
`Object` | `isEmail()` returns true if the string looks like an e-mail
`Object` | `isFileName()` function checks if the string passed contains any characters that are forbidden in image- or filenames
`Object` | `isHexColor()` function checks a string for a valid color value in hexadecimal format.
`Object` | `isNumeric()` function returns true if the string contains only 0-9
`Object` | `isUrl()` function checks if the string passed contains any characters that are forbidden in URLs and tries to create a java.net.URL from it FIXME: probably deprecated -> helma.Url
`Object` | `md5()` function calculates the md5 hash of a string
`Object` | `pad(str, len, mode)` fills a string with another string up to a desired length
`Object` | `parseJSON()`
`Object` | `repeat(multiplier)` function repeats a string passed as argument
`Object` | `startsWith(str, offset)` function returns true if the string starts with the string passed as argument
`Object` | `stripTags()`
`Object` | `tail(limit, clipping, delimiter)` get the tail of a string
`Object` | `titleize()` transforms the first n characters of each word in a string to uppercase
`Object` | `toAlphanumeric()` function cleans a string by throwing away all non-alphanumeric characters
`Object` | `toDate(format, timezone)` parse a timestamp into a date object.
`Object` | `toFileName()` function cleans the string passed as argument from any characters that are forbidden or shouldn't be used in filenames
`Object` | `toHexColor()` converts a string into a hexadecimal color representation (e.g.
`Object` | `trim()` remove leading and trailing whitespace
`Object` | `unwrap(removeTags, replacement)` replace all linebreaks and optionally all w/br tags
`<static> Object` | `compose()` create a string from a bunch of substrings
`<static> Object` | `join(str1, str2, glue)` append one string onto another and add some "glue" if none of the strings is empty or null.
`<static> Object` | `random(len, mode)` creates a random string (numbers and chars)
`<static> Object` | `Sorter(field, order)` factory to create functions for sorting objects in an array

Properties Detail

### clip

    Object clip

### ANUMPATTERN

    <static> Object ANUMPATTERN

### APATTERN

    <static> Object APATTERN

### BALANCE

    <static> Object BALANCE

### EMAILPATTERN

    <static> Object EMAILPATTERN

### FILEPATTERN

    <static> Object FILEPATTERN

### HEXPATTERN

    <static> Object HEXPATTERN

### ISOFORMAT

    <static> Object ISOFORMAT

### LEFT

    <static> Object LEFT

### NULL

    <static> Object NULL

### NUMPATTERN

    <static> Object NUMPATTERN

### RIGHT

    <static> Object RIGHT

### URLPATTERN

    <static> Object URLPATTERN

Method Detail

### capitalize

    Object capitalize(limit)

transforms the first n characters of a string to uppercase

Parameters:

`Number` - amount of characters to transform

Returns:

String the resulting string

### contains

    Object contains(str, fromIndex)

function returns true if a string contains the string passed as argument

Parameters:

`String` - string to search for

`Int` - Position to start search

`Boolean` -

### count

    Object count(str)

returns the amount of occurences of one string in another

### debase64

    Object debase64()

returns the decoded string using the base64 algorithm

### diff

    Object diff(mod, separator)

function compares a string with the one passed as argument using diff

Parameters:

`String` - String to compare against String object value

`String` - Optional regular expression string to use for splitting. If not defined, newlines will be used.

Returns:

Object Array containing one JS object for each line with the following properties: .num Line number .value String line if unchanged .deleted Obj Array containing deleted lines .inserted Obj Array containing added lines

### embody

    Object embody(limit, clipping, delimiter)

breaks up a string into two parts called head and tail at the given position don't apply this to HTML, i.e. use stripTags() in advance

Parameters:

`Number` - number of charactrers or of segments separated by the delimiter

`String` - pre-/suffix to be pre-/appended to shortened string

`String` - delimiter

Returns:

Object containing head and tail properties

### enbase64

    Object enbase64()

returns the string encoded using the base64 algorithm

### encode

    Object encode()

### encodeForm

    Object encodeForm()

### encodeXml

    Object encodeXml()

### endsWith

    Object endsWith(str)

function returns true if the string ends with the string passed as argument

Parameters:

`String` - string pattern to search for

Returns:

Boolean true in case it matches the end of the string, false otherwise

### entitize

    Object entitize()

translates all characters of a string into HTML entities

Returns:

String translated result

### format

    Object format()

### group

    Object group(interval, str, ignoreWhiteSpace)

function inserts a string every number of characters

Parameters:

`Int` - number of characters after which insertion should take place

`String` - string to be inserted

`Boolean` - definitely insert at each interval position

Returns:

String resulting string

### head

    Object head(limit, clipping, delimiter)

get the head of a string

See:

- String.prototype.embody()

### isAlpha

    Object isAlpha()

function returns true if the string contains only characters a-z

Returns:

Boolean true in case string is alpha, false otherwise

### isAlphanumeric

    Object isAlphanumeric()

function returns true if the string contains only a-z and 0-9 (case insensitive!)

Returns:

Boolean true in case string is alpha, false otherwise

### isDateFormat

    Object isDateFormat()

checks if a date format pattern is correct

Returns:

Boolean true if the pattern is correct

### isEmail

    Object isEmail()

returns true if the string looks like an e-mail

### isFileName

    Object isFileName()

function checks if the string passed contains any characters that are forbidden in image- or filenames

Returns:

Boolean

### isHexColor

    Object isHexColor()

function checks a string for a valid color value in hexadecimal format. it may also contain # as first character

Returns:

Boolean false, if string length (without #) > 6 or < 6 or contains any character which is not a valid hex value

### isNumeric

    Object isNumeric()

function returns true if the string contains only 0-9

Returns:

Boolean true in case string is numeric, false otherwise

### isUrl

    Object isUrl()

function checks if the string passed contains any characters that are forbidden in URLs and tries to create a java.net.URL from it FIXME: probably deprecated -> helma.Url

Returns:

Boolean

See:

- helma.Url.PATTERN

### md5

    Object md5()

function calculates the md5 hash of a string

Returns:

String md5 hash of the string

### pad

    Object pad(str, len, mode)

fills a string with another string up to a desired length

Parameters:

`String` - the filling string

`Number` - the desired length of the resulting string

`Number` - the direction which the string will be padded in: -1: left 0: both (balance) 1: right (you can use the constants String.LEFT, String.BALANCE and String.RIGHT here as well.)

Returns:

String the resulting string

### parseJSON

    Object parseJSON()

### repeat

    Object repeat(multiplier)

function repeats a string passed as argument

Parameters:

`Int` - amount of repetitions

Returns:

String resulting string

### startsWith

    Object startsWith(str, offset)

function returns true if the string starts with the string passed as argument

Parameters:

`String` - string pattern to search for

Returns:

Boolean true in case it matches the beginning of the string, false otherwise

### stripTags

    Object stripTags()

### tail

    Object tail(limit, clipping, delimiter)

get the tail of a string

See:

- String.prototype.embody()

### titleize

    Object titleize()

transforms the first n characters of each word in a string to uppercase

Returns:

String the resulting string

### toAlphanumeric

    Object toAlphanumeric()

function cleans a string by throwing away all non-alphanumeric characters

Returns:

cleaned string

### toDate

    Object toDate(format, timezone)

parse a timestamp into a date object. This is used when users want to set createtime explicitly when creating/editing stories.

Parameters:

`String` - date format to be applied

`Object` - Java TimeZone Object (optional)

Returns:

Object contains the resulting date

### toFileName

    Object toFileName()

function cleans the string passed as argument from any characters that are forbidden or shouldn't be used in filenames

Returns:

Boolean

### toHexColor

    Object toHexColor()

converts a string into a hexadecimal color representation (e.g. "ffcc33"). also knows how to convert a color string like "rgb (255, 204, 51)".

Returns:

String the resulting hex color (w/o "#")

### trim

    Object trim()

remove leading and trailing whitespace

### unwrap

    Object unwrap(removeTags, replacement)

replace all linebreaks and optionally all w/br tags

Parameters:

`Boolean` - flag indicating if html tags should be replaced

`String` - replacement for the linebreaks / html tags

Returns:

String the unwrapped string

### compose

    <static> Object compose()

create a string from a bunch of substrings

Parameters:

`String` - one or more strings as arguments

Returns:

String the resulting string

### join

    <static> Object join(str1, str2, glue)

append one string onto another and add some "glue" if none of the strings is empty or null.

Parameters:

`String` - the first string

`String` - the string to be appended onto the first one

`String` - the "glue" to be inserted between both strings

Returns:

String the resulting string

### random

    <static> Object random(len, mode)

creates a random string (numbers and chars)

Parameters:

`len` - length of key

`mode` - determines which letters to use. null or 0 = all letters; 1 = skip 0, 1, l and o which can easily be mixed with numbers; 2 = use numbers only

Returns:

random string

### Sorter

    <static> Object Sorter(field, order)

factory to create functions for sorting objects in an array

Parameters:

`String` - name of the field each object is compared with

`Number` - order (ascending or descending)

Returns:

Function ready for use in Array.prototype.sort

SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods

Documentation generated by JSDoc on Thu Apr 5 01:59:00 2007