...
Function | Syntax | Example | Result |
---|---|---|---|
Split() | @fn.split(' '.split(' ')) | Consider @context.Email_Address holds 'John@test.com', then: @fn.split('@context.Email_Address'.split('@')[0]) | John |
In the above example, ‘John@test.com'. The string is split at the character ‘@’ starting from location ‘[0]’, which is the start of the string. The result string is 'John’.
...
Substring function
‘Substring’ function extracts characters from a text string to create another string. The function selects characters between specified locations and returns the same as a new string. On ‘Skill Builder’ page- Text Responses section, use @fn.substring function to select a substring from an attribute value.
Function | Syntax | Example | Result |
---|---|---|---|
Substring | @fn.substring(' '.substring( , )) | Consider @context.OrgName holds 'Serviceaide', then: @fn.substring('@context.OrgName'.substring(0,'@context.OrgName'.length()-4)) | Service |
In the above example, ‘Serviceaide'. Substring is selected starting at location ‘[0]’ till character at location [7] (i.e. string length (11)-4 ). The result is 'Service'
...
Replace function
‘Replace’ function replaces characters specified by location in a given text string with another text string. On ‘Skill Builder’ page- Text Responses section, use @fn.replace function to replace a part of the text response with another string. Note that the function does an exact match and is case sensitive.
Function | Syntax | Example | Result |
---|---|---|---|
Replace | @fn.replace(' '.replace(' ',' ')) | Consider @context.Email_Address holds 'John@test.com', then: @fn.replace('@context.Email_Address'.replace('test','serviceaide')) |
In the above example, ‘John@test.com', string ‘test’ will be replaced by 'serviceaide'. The result is 'John@serviceaide.com'
...
Random Number
RandomNumber function generates a 4-digit random number that can be saved in an attribute for later action while building skills. Random numbers are mostly used for user authentication and verification. For example, OTP generation used for user authentication.
...