{div:style=display:none}
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.\\ \\ Enter additional information related to this 'class' inside the \{div} macro with 'id=description'{div}
{div:id=description}{div}\\
{table:id=|class=servoy sSummary}{colgroup}{column:width=80px|padding=0px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method Summary{th}{tr}{tbody}{tr}{td}[String]{td}{td}[#dateFormat]\(date, format)
Format a date object to a text representation.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getUnicodeCharacter]\(unicodeCharacterNumber)
Returns a string containing the character for the unicode number.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#hasRecords]\(foundset)
Returns true if the (related)foundset exists and has records.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#hasRecords]\(record, relationString)
Returns true if the (related)foundset exists and has records.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#isMondayFirstDayOfWeek]\()
Returns true when Monday is the first day of the week for your current locale setting.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#numberFormat]\(number, digits)
Format a number to have a defined fraction.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#numberFormat]\(number, format)
Format a number to specification.{td}{tr}{tbody}{tbody}{tr}{td}[Date]{td}{td}[#parseDate]\(date, format)
Parse a string to a date object.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#stringEscapeMarkup]\(textString)
Returns the escaped markup text (HTML/XML).{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#stringEscapeMarkup]\(textString, escapeSpaces)
Returns the escaped markup text (HTML/XML).{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#stringEscapeMarkup]\(textString, escapeSpaces, convertToHtmlUnicodeEscapes)
Returns the escaped markup text (HTML/XML).{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#stringFormat]\(text_to_format, parameters)
Formats a string according to format specifiers and arguments.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#stringIndexReplace]\(text, i_start, i_size, replacement_text)
Replaces a portion of a string with replacement text from a specified index.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#stringInitCap]\(text)
Returns all words starting with capital chars.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#stringLeft]\(text, i_size)
Returns a string with the requested number of characters, starting from the left.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#stringLeftWords]\(text, numberof_words)
Returns the number of words, starting from the left.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#stringMD5HashBase16]\(textString)
Returns the md5 hash (encoded as base16) for specified text.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#stringMD5HashBase64]\(textString)
Returns the md5 hash (encoded as base64) for specified text.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#stringMiddle]\(text, i_start, i_size)
Returns a substring from the original string.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#stringMiddleWords]\(text, i_start, numberof_words)
Returns a substring from the original string.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#stringPBKDF2Hash]\(textString)
Returns the PBKDF2 hash for specified text.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#stringPBKDF2Hash]\(textString, iterations)
Returns the PBKDF2 hash for specified text.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#stringPatternCount]\(text, toSearchFor)
Returns the number of times searchString appears in textString.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#stringPosition]\(textString, toSearchFor, i_start, i_occurrence)
Returns the position of the string to search for, from a certain start position and occurrence.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#stringReplace]\(text, search_text, replacement_text)
Replaces a portion of a string with replacement text.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#stringReplaceTags]\(text, scriptable)
Returns the text with %%tags%% replaced, based on provided record or foundset or form.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#stringRight]\(text, i_size)
Returns a string with the requested number of characters, starting from the right.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#stringRightWords]\(text, numberof_words)
Returns the number of words, starting from the right.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#stringToNumber]\(textString)
Filters characters out of from a string and leaves digits, returns the number.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#stringToNumber]\(textString, decimalSeparator)
Filters characters out of from a string and leaves digits, returns the number.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#stringTrim]\(textString)
Returns the string without leading or trailing spaces.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#stringWordCount]\(text)
Returns the number of words in the text string.{td}{tr}{tbody}{tbody}{tr}{td}[Date]{td}{td}[#timestampToDate]\(date)
Returns a datestamp from the timestamp (sets hours,minutes,seconds and milliseconds to 0).{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#validatePBKDF2Hash]\(password, hash)
Validates the given password against the given hash.{td}{tr}{tbody}{table}\\
{table:id=function|class=servoy sDetail}{colgroup}{column:width=100%|padding=0px}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Method Details{th}{tr}{tbody:id=dateFormat-Date_String}{tr:id=name}{td}h6.dateFormat{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}dateFormat{span}{span}\(date, format){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Date]} date -- the date
\{[String]} format -- the format to output
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the date as text{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var formattedDateString = utils.dateFormat(dateobject,'EEE, d MMM yyyy HH:mm:ss');
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getUnicodeCharacter-Number}{tr:id=name}{td}h6.getUnicodeCharacter{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getUnicodeCharacter{span}{span}\(unicodeCharacterNumber){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} unicodeCharacterNumber -- the number indicating the unicode character
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- a string containing the unicode character{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//returns a big dot
var dot = utils.getUnicodeCharacter(9679);
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=hasRecords-JSFoundSet}{tr:id=name}{td}h6.hasRecords{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}hasRecords{span}{span}\(foundset){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[JSFoundSet]} foundset -- the foundset to be tested
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if exists{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//test the orders_to_orderitems foundset
if (elements.customer_id.hasRecords(orders_to_orderitems))
{
//do work on relatedFoundSet
}
//test the orders_to_orderitems.orderitems_to_products foundset to be reached from the current record
//if (elements.customer_id.hasRecords(foundset.getSelectedRecord(),'orders_to_orderitems.orderitems_to_products'))
//{
// //do work on deeper relatedFoundSet
//}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=hasRecords-JSRecord_String}{tr:id=name}{td}h6.hasRecords{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}hasRecords{span}{span}\(record, relationString){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[JSRecord]} record -- A JSRecord to test.
\{[String]} relationString -- The relation name.
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if the foundset/relation has records.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//test the orders_to_orderitems foundset
if (elements.customer_id.hasRecords(orders_to_orderitems))
{
//do work on relatedFoundSet
}
//test the orders_to_orderitems.orderitems_to_products foundset to be reached from the current record
//if (elements.customer_id.hasRecords(foundset.getSelectedRecord(),'orders_to_orderitems.orderitems_to_products'))
//{
// //do work on deeper relatedFoundSet
//}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=isMondayFirstDayOfWeek}{tr:id=name}{td}h6.isMondayFirstDayOfWeek{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}isMondayFirstDayOfWeek{span}{span}\(){span}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if Monday is first day of the week in current locale{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
if(utils.isMondayFirstDayOfWeek())
{
//a date calculation
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=numberFormat-Number_Number}{tr:id=name}{td}h6.numberFormat{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}numberFormat{span}{span}\(number, digits){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} number -- the number to format
\{[Number]} digits -- nr of digits
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the resulting number in text{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var textalNumber = utils.numberFormat(16.749, 2); //returns 16.75
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=numberFormat-Number_String}{tr:id=name}{td}h6.numberFormat{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}numberFormat{span}{span}\(number, format){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} number -- the number to format
\{[String]} format -- the format
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the resulting number in text{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var textalNumber2 = utils.numberFormat(100006.749, '#,###.00'); //returns 100,006.75
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=parseDate-String_String}{tr:id=name}{td}h6.parseDate{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Date]{span}{span:style=font-weight: bold;}parseDate{span}{span}\(date, format){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} date -- the date as text
\{[String]} format -- the format to parse the to date
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Date] -- the date as date object{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var parsedDate = utils.parseDate(datestring,'EEE, d MMM yyyy HH:mm:ss');
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringEscapeMarkup-String}{tr:id=name}{td}h6.stringEscapeMarkup{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}stringEscapeMarkup{span}{span}\(textString){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} textString -- the text to process
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the escaped text{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var escapedText = utils.stringEscapeMarkup('<html><body>escape me</body></html>')
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringEscapeMarkup-String_Boolean}{tr:id=name}{td}h6.stringEscapeMarkup{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}stringEscapeMarkup{span}{span}\(textString, escapeSpaces){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} textString -- the text to process
\{[Boolean]} escapeSpaces -- indicating to escape spaces
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the escaped text{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var escapedText = utils.stringEscapeMarkup('<html><body>escape me</body></html>')
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringEscapeMarkup-String_Boolean_Boolean}{tr:id=name}{td}h6.stringEscapeMarkup{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}stringEscapeMarkup{span}{span}\(textString, escapeSpaces, convertToHtmlUnicodeEscapes){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} textString -- the text to process
\{[Boolean]} escapeSpaces -- indicating to escape spaces
\{[Boolean]} convertToHtmlUnicodeEscapes -- indicating to use unicode escapes
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the escaped text{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var escapedText = utils.stringEscapeMarkup('<html><body>escape me</body></html>')
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringFormat-String_ObjectArray}{tr:id=name}{td}h6.stringFormat{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}stringFormat{span}{span}\(text_to_format, parameters){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} text_to_format -- the text to format
\{[Object]\[]} parameters -- the array with parameters
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the formatted text{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
// the format specifier has the syntax: %[argument_index$][flags][width][.precision]conversion
// argument index is 1$, 2$ ...
// flags is a set of characters that modify the output format
// typical values: '+'(The result will always include a sign), ','(The result will include locale-specific grouping separators)
// width is a non-negative decimal integer indicating the minimum number of characters to be written to the output
// precision is a non-negative decimal integer usually used to restrict the number of characters
// conversion is a character indicating how the argument should be formatted
// typical conversion values: b(boolean), s(string), c(character), d(decimal integer), f(floating number), t(prefix for date and time)
// Date/Time Conversions (used after 't' prefix):
// 'H' Hour of the day for the 24-hour clock, formatted as two digits with a leading zero as necessary i.e. 00 - 23.
// 'I' Hour for the 12-hour clock, formatted as two digits with a leading zero as necessary, i.e. 01 - 12.
// 'k' Hour of the day for the 24-hour clock, i.e. 0 - 23.
// 'l' Hour for the 12-hour clock, i.e. 1 - 12.
// 'M' Minute within the hour formatted as two digits with a leading zero as necessary, i.e. 00 - 59.
// 'S' Seconds within the minute, formatted as two digits with a leading zero as necessary, i.e. 00 - 60 ("60" is a special value required to support leap seconds).
// 'L' Millisecond within the second formatted as three digits with leading zeros as necessary, i.e. 000 - 999.
// 'p' Locale-specific morning or afternoon marker in lower case, e.g."am" or "pm". Use of the conversion prefix 'T' forces this output to upper case.
// 'z' RFC 822 style numeric time zone offset from GMT, e.g. -0800.
// 'Z' A string representing the abbreviation for the time zone.
// 'B' Locale-specific full month name, e.g. "January", "February".
// 'b' Locale-specific abbreviated month name, e.g. "Jan", "Feb".
// 'h' Same as 'b'.
// 'A' Locale-specific full name of the day of the week, e.g. "Sunday", "Monday"
// 'a' Locale-specific short name of the day of the week, e.g. "Sun", "Mon"
// 'C' Four-digit year divided by 100, formatted as two digits with leading zero as necessary, i.e. 00 - 99
// 'Y' Year, formatted as at least four digits with leading zeros as necessary, e.g. 0092 equals 92 CE for the Gregorian calendar.
// 'y' Last two digits of the year, formatted with leading zeros as necessary, i.e. 00 - 99.
// 'j' Day of year, formatted as three digits with leading zeros as necessary, e.g. 001 - 366 for the Gregorian calendar.
// 'm' Month, formatted as two digits with leading zeros as necessary, i.e. 01 - 13.
// 'd' Day of month, formatted as two digits with leading zeros as necessary, i.e. 01 - 31
// 'e' Day of month, formatted as two digits, i.e. 1 - 31.
// common compositions for date/time conversion
// 'R' Time formatted for the 24-hour clock as "%tH:%tM"
// 'T' Time formatted for the 24-hour clock as "%tH:%tM:%tS".
// 'r' Time formatted for the 12-hour clock as "%tI:%tM:%tS %Tp". The location of the morning or afternoon marker ('%Tp') may be locale-dependent.
// 'D' Date formatted as "%tm/%td/%ty".
// 'F' ISO 8601 complete date formatted as "%tY-%tm-%td".
// 'c' Date and time formatted as "%ta %tb %td %tT %tZ %tY", e.g. "Sun Jul 20 16:17:00 EDT 1969".
utils.stringFormat('%s Birthday: %2$tm %2$te,%2$tY',new Array('My',new Date(2009,0,1))) // returns My Birthday: 01 1,2009
utils.stringFormat('The time is: %1$tH:%1$tM:%1$tS',new Array(new Date(2009,0,1,12,0,0))) // returns The time is: 12:00:00
utils.stringFormat('My %s: %2$.0f, my float: %2$.2f',new Array('integer',10)) // returns My integer: 10, my float: 10.00
utils.stringFormat('Today is: %1$tc',new Array(new Date())) // returns current date/time as: Today is: Fri Feb 20 14:15:54 EET 2009
utils.stringFormat('Today is: %tF',new Array(new Date())) // returns current date as: Today is: 2009-02-20
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringIndexReplace-String_Number_Number_String}{tr:id=name}{td}h6.stringIndexReplace{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}stringIndexReplace{span}{span}\(text, i_start, i_size, replacement_text){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} text -- the text to process
\{[Number]} i_start -- the start index to work from
\{[Number]} i_size -- the size of the text to replace
\{[String]} replacement_text -- the replacement text
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the changed text string{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//returns 'this was a test'
var retval = utils.stringIndexReplace('this is a test',6,2,'was');
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringInitCap-String}{tr:id=name}{td}h6.stringInitCap{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}stringInitCap{span}{span}\(text){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} text -- the text to process
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the changed text{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//returns 'This Is A Test'
var retval = utils.stringInitCap('This is A test');
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringLeft-String_Number}{tr:id=name}{td}h6.stringLeft{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}stringLeft{span}{span}\(text, i_size){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} text -- the text to process
\{[Number]} i_size -- the size of the text to return
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the result text string{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//returns 'this i'
var retval = utils.stringLeft('this is a test',6);
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringLeftWords-String_Number}{tr:id=name}{td}h6.stringLeftWords{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}stringLeftWords{span}{span}\(text, numberof_words){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} text -- to process
\{[Number]} numberof_words -- to return
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the string with number of words form the left{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//returns 'this is a'
var retval = utils.stringLeftWords('this is a test',3);
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringMD5HashBase16-String}{tr:id=name}{td}h6.stringMD5HashBase16{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}stringMD5HashBase16{span}{span}\(textString){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} textString -- the text to process
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the resulting hashString{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var hashed_password = utils.stringMD5HashBase16(user_password)
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringMD5HashBase64-String}{tr:id=name}{td}h6.stringMD5HashBase64{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}stringMD5HashBase64{span}{span}\(textString){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} textString -- the text to process
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the resulting hashString{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var hashed_password = utils.stringMD5HashBase64(user_password)
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringMiddle-String_Number_Number}{tr:id=name}{td}h6.stringMiddle{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}stringMiddle{span}{span}\(text, i_start, i_size){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} text -- the text to process
\{[Number]} i_start -- the start index to work from
\{[Number]} i_size -- the size of the text to return
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the result text string{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//returns 'his'
var retval = utils.stringMiddle('this is a test',2,3);
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringMiddleWords-String_Number_Number}{tr:id=name}{td}h6.stringMiddleWords{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}stringMiddleWords{span}{span}\(text, i_start, numberof_words){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} text -- to process
\{[Number]} i_start -- start word index
\{[Number]} numberof_words -- the word count to return
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the string with number of words form the left and{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//returns 'is a'
var retval = utils.stringMiddleWords('this is a test',2,2);
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringPBKDF2Hash-String}{tr:id=name}{td}h6.stringPBKDF2Hash{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}stringPBKDF2Hash{span}{span}\(textString){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} textString -- the text to process
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the resulting hashString{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var hashed_password = utils.stringPBKDF2Hash(user_password)
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringPBKDF2Hash-String_Number}{tr:id=name}{td}h6.stringPBKDF2Hash{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}stringPBKDF2Hash{span}{span}\(textString, iterations){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} textString -- the text to process
\{[Number]} iterations -- how many hash iterations should be done, minimum should be 1000 or higher.
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the resulting hashString{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var hashed_password = utils.stringPBKDF2Hash(user_password,5000)
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringPatternCount-String_String}{tr:id=name}{td}h6.stringPatternCount{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}stringPatternCount{span}{span}\(text, toSearchFor){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} text -- the text to process
\{[String]} toSearchFor -- the string to search for
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- the occurrenceCount that the search string is found in the text{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//returns 2 as count
var count = utils.stringPatternCount('this is a test','is');
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringPosition-String_String_Number_Number}{tr:id=name}{td}h6.stringPosition{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}stringPosition{span}{span}\(textString, toSearchFor, i_start, i_occurrence){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} textString -- the text to process
\{[String]} toSearchFor -- the string to search
\{[Number]} i_start -- the start index to search from
\{[Number]} i_occurrence -- the occurrence
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- the position{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//returns 4 as position
var pos = utils.stringPosition('This is a test','s',1,1)
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringReplace-String_String_String}{tr:id=name}{td}h6.stringReplace{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}stringReplace{span}{span}\(text, search_text, replacement_text){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} text -- the text to process
\{[String]} search_text -- the string to search
\{[String]} replacement_text -- the replacement text
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the changed text string{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//returns 'these are cow 1 and cow 2.'
var retval = utils.stringReplace('these are test 1 and test 2.','test','cow');
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringReplaceTags-String_Object}{tr:id=name}{td}h6.stringReplaceTags{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}stringReplaceTags{span}{span}\(text, scriptable){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} text -- the text tags to work with
\{[Object]} scriptable -- the javascript object or foundset,record,form to be used to fill in the tags
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the text with replaced tags{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//Next line places a string in variable x, whereby the tag(%%TAG%%) is filled with the value of the database column 'company_name' of the selected record.
var x = utils.stringReplaceTags("The companyName of the selected record is %%company_name%% ", foundset)
//var otherExample = utils.stringReplaceTags("The amount of the related order line %%amount%% ", order_to_orderdetails);
//var recordExample = utils.stringReplaceTags("The amount of the related order line %%amount%% ", order_to_orderdetails.getRecord(i);
//Next line places a string in variable y, whereby the tag(%%TAG%%) is filled with the value of the form variable 'x' of the form named 'main'.
//var y = utils.stringReplaceTags("The value of form variable is %%x%% ", forms.main);
//The next sample shows the use of a javascript object
//var obj = new Object();//create a javascript object
//obj['x'] = 'test';//assign an named value
//var y = utils.stringReplaceTags("The value of object variable is %%x%% ", obj);//use the named value in a tag
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringRight-String_Number}{tr:id=name}{td}h6.stringRight{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}stringRight{span}{span}\(text, i_size){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} text -- the text to process
\{[Number]} i_size -- the size of the text to return
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the result text string{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//returns 'a test'
var retval = utils.stringLeft('this is a test',6);
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringRightWords-String_Number}{tr:id=name}{td}h6.stringRightWords{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}stringRightWords{span}{span}\(text, numberof_words){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} text -- to process
\{[Number]} numberof_words -- to return
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the string with number of words form the right{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//returns 'is a test'
var retval = utils.stringRightWords('this is a test',3);
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringToNumber-String}{tr:id=name}{td}h6.stringToNumber{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}stringToNumber{span}{span}\(textString){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} textString -- the text to process
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- the resulting number{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//returns 65567
var retval = utils.stringToNumber('fg65gf567');
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringToNumber-String_String}{tr:id=name}{td}h6.stringToNumber{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}stringToNumber{span}{span}\(textString, decimalSeparator){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} textString -- the text to process
\{[String]} decimalSeparator -- decimal separator
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- the resulting number{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//returns 65.567
var retval = utils.stringToNumber('fg65gf.567','.');
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringTrim-String}{tr:id=name}{td}h6.stringTrim{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}stringTrim{span}{span}\(textString){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} textString -- the text to process
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- the resulting trimmed string{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//returns 'text'
var retval = utils.stringTrim(' text ');
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=stringWordCount-String}{tr:id=name}{td}h6.stringWordCount{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}stringWordCount{span}{span}\(text){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} text -- the text to process
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- the word count{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//returns '4' as result
var retval = utils.stringWordCount('this is a test');
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=timestampToDate-Date}{tr:id=name}{td}h6.timestampToDate{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Date]{span}{span:style=font-weight: bold;}timestampToDate{span}{span}\(date){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Date]} date -- object to be stripped from its time elements
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Date] -- the stripped date object{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var date = utils.timestampToDate(application.getTimeStamp());
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=validatePBKDF2Hash-String_String}{tr:id=name}{td}h6.validatePBKDF2Hash{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}validatePBKDF2Hash{span}{span}\(password, hash){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} password -- the password to test against
\{[String]} hash -- the hash the password needs to validate to.
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if his hash is valid for that password{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
if (utils.validatePBKDF2Hash(user_password, hashFromDb)) {
// logged in
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}
Cache
index
true
refresh
100d
showRefresh
true
id
doc
title
Refresh page
showDate
true
retry
Enable
servoy sReturnTypes2100%height: 30px;2Supported ClientssWordListSmartClientsWordListWebClientsWordListNGClientsWordListMobileClientservoy sSummary12%30%58%height: 30px;3Methods SummaryReturn the byte array representation of the Base64 valueReturn the String representation of the Base64 valueReturn the Base64 value representation of the byteArrayReturn the string conversion of the byteArrayFormat a date object to a text representation.Format a date object to a text representation using the format and timezone given.Format a date object to a text representation.Format a date object to a text representation using the format, timezone, language and country given.Returns a string containing the character for the unicode number.Returns true if the (related)foundset exists and has records.Returns true if the (related)foundset exists and has records.Returns true when Monday is the first day of the week for your current locale setting.Format a number to have a defined fraction.Format a number to have a defined fraction.Format a number to specification.Format a number to specification.Parse a string to a date object.Parse a string to a date object.Parse a string to a date object.Parse a string to a date object.Returns the escaped markup text (HTML/XML).Returns the escaped markup text (HTML/XML).Returns the escaped markup text (HTML/XML).Formats a string according to format specifiers and arguments.Format a string using mask.Replaces a portion of a string with replacement text from a specified index.Returns all words starting with capital chars.Returns a string with the requested number of characters, starting from the left.Returns the number of words, starting from the left.Returns the md5 hash (encoded as base16) for specified text.Returns the md5 hash (encoded as base64) for specified text.Returns a substring from the original string.Returns a substring from the original string.Returns the PBKDF2 hash for specified text.Returns the PBKDF2 hash for specified text.Returns the number of times searchString appears in textString.Returns the position of the string to search for, from a certain start position and occurrence.Replaces a portion of a string with replacement text.Returns the text with %%tags%% replaced, based on provided record or foundset or form.Returns a string with the requested number of characters, starting from the right.Returns the number of words, starting from the right.Return the Base64 representation of the stringReturn the byte array representation of the stringFilters characters out of from a string and leaves digits, returns the number.Filters characters out of from a string and leaves digits, returns the number.Returns the string without leading or trailing spaces.Returns the number of words in the text string.Returns a datestamp from the timestamp (sets hours,minutes,seconds and milliseconds to 0).Validates the given password against the given hash.functionservoy sDetail2100%height:30px2Methods Detailsbase64ToBytesname
base64ToBytes(base64String:)
dessIndent
Return the byte array representation of the Base64 value
prs
Parameters
sIndentbase64String:the Base64 encoded string to convert to byte arrayret
Returns
sIndent byteArray representation of the base64 string using UTF-8 charset for conversionclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRowbase64ToStringname
base64ToString(base64String:)
dessIndent
Return the String representation of the Base64 value
prs
Parameters
sIndentbase64String:the Base64 value to convert to Stringret
Returns
sIndent String decoded representation of the Base64 value using UTF-8 charset for conversionclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRowbytesToBase64name
bytesToBase64(byteArray:)
dessIndent
Return the Base64 value representation of the byteArray
prs
Parameters
sIndentbyteArray:the byte array to convert to Base64 valueret
Returns
sIndent Base64 representation of the byte array using UTF-8 charset for conversionclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRowbytesToHexname
bytesToHex(bytearray)
dessIndentprs
Parameters
sIndentbytearraythe byte array to convert to hex encoded stringret
Returns
sIndent returns hex encoded string from bytearrayclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRowbytesToStringname
bytesToString(byteArray:)
dessIndent
Return the string conversion of the byteArray
prs
Parameters
sIndentbyteArray:the byte array to convert toret
Returns
sIndent string representation of the byte array using UTF-8 charset for conversionclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRowdateFormatname
dateFormat(date, format)
dessIndent
Format a date object to a text representation.
This will format with the system timezone for the webclient
For NGClient it will use the timezone of the client, the same goes for the Smartclient (but that is the system timezone)
see #dateFormat(Date,String,String) for using the actual clients timezone.
Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'.
Symbols meaning is:
G era designator
y year
Y week year
M month in year
d day in month
h hour in am/pm (1~12)
H hour in day (0~23)
m minute in hour
s second in minute
S millisecond
E day in week
D day in year
F day of week in month
w week in year
W week in month
a am/pm marker
z time zone
k hour in day (1~24)
K hour in am/pm (0~11)
Format a date object to a text representation using the format and timezone given.
If the timezone is not given the timezone of the client itself will be used.
see i18n.getAvailableTimeZoneIDs() to get a timezone string that can be used.
Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'
Symbols meaning is:
G era designator
y year
Y week year
M month in year
d day in month
h hour in am/pm (1~12)
H hour in day (0~23)
m minute in hour
s second in minute
S millisecond
E day in week
D day in year
F day of week in month
w week in year
W week in month
a am/pm marker
z time zone
k hour in day (1~24)
K hour in am/pm (0~11)
prs
Parameters
sIndentdatethe dateformatthe format to outputtimezoneThe timezone string to use to parse the date (like GMT+3), if null then the timezone of the current client is used.ret
Returns
sIndent the date as textclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRowdateFormatname
dateFormat(date, format, language, country)
dessIndent
Format a date object to a text representation.
This will format with the system timezone for the webclient
With language and/or country the locale will be created.
For NGClient it will use the timezone of the client, the same goes for the Smartclient (but that is the system timezone)
see #dateFormat(Date,String,String) for using the actual clients timezone.
Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'.
Symbols meaning is:
G era designator
y year
Y week year
M month in year
d day in month
h hour in am/pm (1~12)
H hour in day (0~23)
m minute in hour
s second in minute
S millisecond
E day in week
D day in year
F day of week in month
w week in year
W week in month
a am/pm marker
z time zone
k hour in day (1~24)
K hour in am/pm (0~11)
prs
Parameters
sIndentdatethe dateformatthe format to outputlanguagelanguage used to create localecountrycountry used along side language to create the localeret
Returns
sIndent the date as textclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRowdateFormatname
dateFormat(date, format, timezone, language, country)
dessIndent
Format a date object to a text representation using the format, timezone, language and country given.
With the language and country given, the locale will be created.
If the timezone is not given the timezone of the client itself will be used.
see i18n.getAvailableTimeZoneIDs() to get a timezone string that can be used.
Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'
Symbols meaning is:
G era designator
y year
Y week year
M month in year
d day in month
h hour in am/pm (1~12)
H hour in day (0~23)
m minute in hour
s second in minute
S millisecond
E day in week
D day in year
F day of week in month
w week in year
W week in month
a am/pm marker
z time zone
k hour in day (1~24)
K hour in am/pm (0~11)
prs
Parameters
sIndentdatethe dateformatthe format to outputtimezonethe timezone to use the format, if null then current client timezone is used.languagelanguage used to create localecountrycountry used along side language to create the localeret
Returns a string containing the character for the unicode number.
prs
Parameters
sIndentunicodeCharacterNumberthe number indicating the unicode characterret
Returns
sIndent a string containing the unicode characterclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRowhasRecordsname
hasRecords(foundset)
dessIndent
Returns true if the (related)foundset exists and has records.
Another use is, to pass a record and qualified relations string to test multiple relations/foundset at once
Returns true if the (related)foundset exists and has records.
Another use is, to pass a record and qualified relations string to test multiple relations/foundset at once
prs
Parameters
sIndentrecordA JSRecord to test.relationStringThe relation name.ret
Returns
sIndent true if the foundset/relation has records.clients
sIndentnumberthe number to formatdigitsnr of digitslanguagelanguage used to create localecountrycountry used along side language to create the localeret
Returns
sIndent the resulting number in textclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRownumberFormatname
numberFormat(number, format)
dessIndent
Format a number to specification.
prs
Parameters
sIndentnumberthe number to formatformatthe formatret
sIndentnumberthe number to formatformatthe formatlanguagelanguage used to create localecountrycountry used along side language to create the localeret
Returns
sIndent the resulting number in textclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRowparseDatename
parseDate(date, format)
dessIndent
Parse a string to a date object. This parses the date using the TimeZone of the server
Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'
prs
Parameters
sIndentdatethe date as textformatthe format to parse the dateret
Returns
sIndent the date as date objectclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRowparseDatename
parseDate(date, format, timezone)
dessIndent
Parse a string to a date object. Using the timezone that is given, if null then it formats it with the clients timezone.
see i18n.getAvailableTimeZoneIDs() to get a timezone string that can be used.
Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'
prs
Parameters
sIndentdatethe date as textformatthe format to parse the datetimezoneThe timezone string to use to parse the date (like GMT+3)ret
Returns
sIndent the date as date objectclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRowparseDatename
parseDate(date, format, language, country)
dessIndent
Parse a string to a date object. Using language and country that are given,
if null then it formats it with the locale of the client
Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'
prs
Parameters
sIndentdatethe date as textformatthe format to parse the datelanguagelanguage used to create localecountrycountry used along side language to create the localeret
Returns
sIndent the date as date objectclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRowparseDatename
parseDate(date, format, timezone, language, country)
dessIndent
Parse a string to a date object. Using the timezone, language and country that are given,
if null then it formats it with the timezone and locale of the client
see i18n.getAvailableTimeZoneIDs() to get a timezone string that can be used.
Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'
prs
Parameters
sIndentdatethe date as textformatthe format to parse the datetimezoneThe timezone string to use to parse the date (like GMT+3)languagelanguage used to create localecountrycountry used along side language to create the localeret
Returns the md5 hash (encoded as base16) for specified text.
NOTE: MD5 (Message-Digest Algorythm 5) is a hash function with a 128-bit hash value, for more info see: http://en.wikipedia.org/wiki/MD5
Returns the md5 hash (encoded as base64) for specified text.
NOTE: MD5 (Message-Digest Algorythm 5) is a hash function with a 128-bit hash value, for more info see: http://en.wikipedia.org/wiki/MD5
prs
Parameters
sIndenttextStringthe text to processret
Returns
sIndent the resulting hashStringclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRowstringMiddlename
stringMiddle(text, i_start, i_size)
dessIndent
Returns a substring from the original string.
prs
Parameters
sIndenttextthe text to processi_startthe start index to work fromi_sizethe size of the text to returnret
sIndenttextto processi_startstart word indexnumberof_wordsthe word count to returnret
Returns
sIndent the string with number of words form the left andclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRowstringPBKDF2Hashname
stringPBKDF2Hash(textString)
dessIndent
Returns the PBKDF2 hash for specified text. This method is preferred above the old MD5 hash for enhanced security.
It uses a default of 9999 iterations. The string that is returned can only be used in the utils.validatePBKDF2Hash(password,thisReturnValue)
to check if this hash is a result of that password.
This will always be false: utils.stringPBKDF2Hash("test") == utils.stringPBKDF2Hash("test"). Because for the same string in multiply calls it will not generate the same hash.
So you can only check it like this: utils.validatePBKDF2Hash("test",utils.stringPBKDF2Hash("test"))
NOTE: PBKDF2 is the key hash function for the PKCS (Public-Key Cryptography) standard, for more info see: http://en.wikipedia.org/wiki/PBKDF2
prs
Parameters
sIndenttextStringthe text to processret
Returns
sIndent the resulting hashStringclients
Supported Clients
sIndentSmartClient,WebClient,NGClientsam
Sample
sIdentjavascriptlastDetailRowstringPBKDF2Hashname
stringPBKDF2Hash(textString, iterations)
dessIndent
Returns the PBKDF2 hash for specified text. This method is preferred above the old MD5 hash for enhanced security.
NOTE: PBKDF2 is the key hash function for the PKCS (Public-Key Cryptography) standard, for more info see: http://en.wikipedia.org/wiki/PBKDF2
prs
Parameters
sIndenttextStringthe text to processiterationshow many hash iterations should be done, minimum should be 1000 or higher.ret
Validates the given password against the given hash. The hash should be generated by one of the stringPBKDF2Hash(password [,iteration]) functions. If hash is null or empty string the method will return false.
NOTE: PBKDF2 is the key hash function for the PKCS (Public-Key Cryptography) standard, for more info see: http://en.wikipedia.org/wiki/PBKDF2
prs
Parameters
sIndentpasswordthe password to test againsthashthe hash the password needs to validate to.ret
Returns
sIndent true if his hash is valid for that passwordclients