Detailed reference of prototypes, properties and methods available in the
Javascript environment of your Helma web applications.

Adds useful methods to the JavaScript String type.

To use this optional module, its repository needs to be added to the application, for example by calling app.addRepository('modules/core/String.js')
Methods
String. isDateFormat()
checks if a date format pattern is correct
returns
Boolean true if the pattern is correct
String. toDate(String, Object)
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
String. 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
String. isFileName()
function checks if the string passed contains any characters that are forbidden in image- or filenames
returns
Boolean
String. toFileName()
function cleans the string passed as argument from any characters that are forbidden or shouldn't be used in filenames
returns
Boolean
String. 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
String. 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 "#")
String. 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
String. toAlphanumeric()
function cleans a string by throwing away all non-alphanumeric characters
returns
cleaned string
String. isAlpha()
function returns true if the string contains only characters a-z
returns
Boolean true in case string is alpha, false otherwise
String. isNumeric()
function returns true if the string contains only 0-9
returns
Boolean true in case string is numeric, false otherwise
String. capitalize(Number)
transforms the first n characters of a string to uppercase
parameters
Number amount of characters to transform
returns
String the resulting string
String. titleize()
transforms the first n characters of each word in a string to uppercase
returns
String the resulting string
String. entitize()
translates all characters of a string into HTML entities
returns
String translated result
String. embody(Number, String, String)
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
String. head(limit, clipping, delimiter)
get the head of a string
parameters
limit
clipping
delimiter
see
String. tail(limit, clipping, delimiter)
get the tail of a string
parameters
limit
clipping
delimiter
see
String. group(Int, String, Boolean)
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
String. unwrap(Boolean, String)
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
String. md5()
function calculates the md5 hash of a string
returns
String md5 hash of the string
String. repeat(Int)
function repeats a string the specified amount of times
parameters
Int amount of repetitions
returns
String resulting string
String. startsWith(String)
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
String. endsWith(String)
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
String. pad(String, Number, Number)
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
String. contains(String, Int, Boolean)
function returns true if a string contains the string passed as argument
parameters
String string to search for
Int Position to start search
Boolean
String. diff(String, String)
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
String. trim()
remove leading and trailing whitespace
String. isEmail()
returns true if the string looks like an e-mail
String. count(str)
returns the amount of occurences of one string in another
parameters
str
String. enbase64()
returns the string encoded using the base64 algorithm
String. debase64()
returns the decoded string using the base64 algorithm
String. Sorter(String, Number)
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
String. compose(String)
create a string from a bunch of substrings
parameters
String one or more strings as arguments
returns
String the resulting string
String. 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
String. join(String, String, String)
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
Fri, 05 Feb 2010 17:40:05 GMT.

core framework

optional modules

java libraries

properties files