Child pages
  • Utils

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Cache
indextrue
refresh100d
showRefreshtrue
iddoc
titleRefresh page
showDatetrue
retryEnable

servoy sReturnTypes2100%height: 30px;2Supported ClientssWordListSmartClientsWordListWebClientsWordListNGClientsWordListMobileClient

servoy sSummary12%30%58%height: 30px;3Methods SummaryFormat a date object to a text representation.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 specification.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.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.Filters 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 DetailsdateFormatname

dateFormat(date, format)

dessIndentFormat a date object to a text representation.prs

Parameters

sIndentdatethe dateformatthe format to output
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow getUnicodeCharactername

getUnicodeCharacter(unicodeCharacterNumber)

dessIndentReturns a string containing the character for the unicode number.prs

Parameters

sIndentunicodeCharacterNumberthe number indicating the unicode character
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
hasRecordsname

hasRecords(foundset)

dessIndentReturns 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 onceprs

Parameters

sIndentfoundsetthe foundset to be tested
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
hasRecordsname

hasRecords(record, relationString)

dessIndentReturns 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 onceprs

Parameters

sIndentrecordA JSRecord to test.relationStringThe relation name.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
isMondayFirstDayOfWeekname

isMondayFirstDayOfWeek()

dessIndentReturns true when Monday is the first day of the week for your current locale setting.ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
numberFormatname

numberFormat(number, digits)

dessIndentFormat a number to have a defined fraction.prs

Parameters

sIndentnumberthe number to formatdigitsnr of digits
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
numberFormatname

numberFormat(number, format)

dessIndentFormat a number to specification.prs

Parameters

sIndentnumberthe number to formatformatthe format
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
parseDatename

parseDate(date, format)

dessIndentParse a string to a date object.prs

Parameters

sIndentdatethe date as textformatthe format to parse the to date
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringEscapeMarkupname

stringEscapeMarkup(textString)

dessIndentReturns the escaped markup text (HTML/XML).prs

Parameters

sIndenttextStringthe text to process
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringEscapeMarkupname

stringEscapeMarkup(textString, escapeSpaces)

dessIndentReturns the escaped markup text (HTML/XML).prs

Parameters

sIndenttextStringthe text to processescapeSpacesindicating to escape spaces
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringEscapeMarkupname

stringEscapeMarkup(textString, escapeSpaces, convertToHtmlUnicodeEscapes)

dessIndentReturns the escaped markup text (HTML/XML).prs

Parameters

sIndenttextStringthe text to processescapeSpacesindicating to escape spacesconvertToHtmlUnicodeEscapesindicating to use unicode escapes
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringFormatname

stringFormat(text_to_format, parameters)

dessIndentFormats a string according to format specifiers and arguments.prs

Parameters

sIndenttext_to_formatthe text to formatparametersthe array with parameters
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringIndexReplacename

stringIndexReplace(text, i_start, i_size, replacement_text)

dessIndentReplaces a portion of a string with replacement text from a specified index.prs

Parameters

sIndenttextthe text to processi_startthe start index to work fromi_sizethe size of the text to replacereplacement_textthe replacement text
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringInitCapname

stringInitCap(text)

dessIndentReturns all words starting with capital chars.prs

Parameters

sIndenttextthe text to process
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringLeftname

stringLeft(text, i_size)

dessIndentReturns a string with the requested number of characters, starting from the left.prs

Parameters

sIndenttextthe text to processi_sizethe size of the text to return
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringLeftWordsname

stringLeftWords(text, numberof_words)

dessIndentReturns the number of words, starting from the left.prs

Parameters

sIndenttextto processnumberof_wordsto return
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringMD5HashBase16name

stringMD5HashBase16(textString)

dessIndentReturns 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/MD5prs

Parameters

sIndenttextStringthe text to process
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringMD5HashBase64name

stringMD5HashBase64(textString)

dessIndentReturns 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/MD5prs

Parameters

sIndenttextStringthe text to process
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringMiddlename

stringMiddle(text, i_start, i_size)

dessIndentReturns a substring from the original string.prs

Parameters

sIndenttextthe text to processi_startthe start index to work fromi_sizethe size of the text to return
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringMiddleWordsname

stringMiddleWords(text, i_start, numberof_words)

dessIndentReturns a substring from the original string.prs

Parameters

sIndenttextto processi_startstart word indexnumberof_wordsthe word count to return
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringPBKDF2Hashname

stringPBKDF2Hash(textString)

dessIndentReturns 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/PBKDF2prs

Parameters

sIndenttextStringthe text to process
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringPBKDF2Hashname

stringPBKDF2Hash(textString, iterations)

dessIndentReturns 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/PBKDF2prs

Parameters

sIndenttextStringthe text to processiterationshow many hash iterations should be done, minimum should be 1000 or higher.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringPatternCountname

stringPatternCount(text, toSearchFor)

dessIndentReturns the number of times searchString appears in textString.prs

Parameters

sIndenttextthe text to processtoSearchForthe string to search for
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringPositionname

stringPosition(textString, toSearchFor, i_start, i_occurrence)

dessIndentReturns the position of the string to search for, from a certain start position and occurrence.prs

Parameters

sIndenttextStringthe text to processtoSearchForthe string to searchi_startthe start index to search fromi_occurrencethe occurrence
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringReplacename

stringReplace(text, search_text, replacement_text)

dessIndentReplaces a portion of a string with replacement text.prs

Parameters

sIndenttextthe text to processsearch_textthe string to searchreplacement_textthe replacement text
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringReplaceTagsname

stringReplaceTags(text, scriptable)

dessIndentReturns the text with %%tags%% replaced, based on provided record or foundset or form.prs

Parameters

sIndenttextthe text tags to work withscriptablethe javascript object or foundset,record,form to be used to fill in the tags
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringRightname

stringRight(text, i_size)

dessIndentReturns a string with the requested number of characters, starting from the right.prs

Parameters

sIndenttextthe text to processi_sizethe size of the text to return
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringRightWordsname

stringRightWords(text, numberof_words)

dessIndentReturns the number of words, starting from the right.prs

Parameters

sIndenttextto processnumberof_wordsto return
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringToNumbername

stringToNumber(textString)

dessIndentFilters characters out of from a string and leaves digits, returns the number. Uses locale decimal separator.prs

Parameters

sIndenttextStringthe text to process
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringToNumbername

stringToNumber(textString, decimalSeparator)

dessIndentFilters characters out of from a string and leaves digits, returns the number. Decimal separator is specified as parameter.prs

Parameters

sIndenttextStringthe text to processdecimalSeparatordecimal separator
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringTrimname

stringTrim(textString)

dessIndentReturns the string without leading or trailing spaces.prs

Parameters

sIndenttextStringthe text to process
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
stringWordCountname

stringWordCount(text)

dessIndentReturns the number of words in the text string.prs

Parameters

sIndenttextthe text to process
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
timestampToDatename

timestampToDate(date)

dessIndentReturns a datestamp from the timestamp (sets hours,minutes,seconds and milliseconds to 0).prs

Parameters

sIndentdateobject to be stripped from its time elements
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
validatePBKDF2Hashname

validatePBKDF2Hash(password, hash)

dessIndentValidates 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/PBKDF2prs

Parameters

sIndentpasswordthe password to test againsthashthe hash the password needs to validate to.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow