Referencing Functions
You can reference functions to quickly configure connectors when editing and designing a composite application.
Figure 1 describes how to use functions in composite applications.
Category
Math, string, encryption and decryption, date and time, encoding and decoding, and number system conversion.
Category |
Function |
Description |
---|---|---|
Math (2) |
sum(array arr) |
Returns the sum of all numbers in an array. |
avg(array arr) |
Returns the average of all numbers in an array. |
|
String (29) |
uuid() |
Generates a random UUID consisting of letters and digits. |
upper(string str) |
Converts a string into uppercase letters. |
|
lower(string str) |
Converts a string into lowercase letters. |
|
camelize(string str) |
Converts words in a string into the camel case format, deletes all spaces, and converts the first letter of each word except the first word into the uppercase format. |
|
dasherize(string str) |
Converts words in a string into the kebab case format, letters into lowercase letters, and all spaces into hyphens (-). |
|
capitalize(string str) |
Converts the first letter of each word into the uppercase format and the other letters into the lowercase format. |
|
charCode(string char) |
Converts characters to character encoding. |
|
fromCharCode(number charCode) |
Converts a character encoding into a string. |
|
charCodeAt(string str, number index) |
Returns the character encoding at the index in a string. |
|
isAlpha(string str) |
Returns a Boolean value that indicates whether a string contains only English letters. |
|
isAlphanumeric(string str) |
Returns a Boolean value that indicates whether a string contains only English letters or digits. |
|
isNumeric(string str) |
Returns a Boolean value that indicates whether a string contains only digits. |
|
isLowerCase(string str) |
Returns a Boolean value that indicates whether a string contains only lowercase letters. |
|
isUpperCase(string str) |
Returns a Boolean value that indicates whether a string contains only uppercase letters. |
|
isWhitespace(string str) |
Returns a Boolean value that indicates whether a string contains only spaces. |
|
leftPad(string str, number offset) |
If the string is shorter than the offset, pads the left side of the string with spaces. |
|
rightPad(string str, number offset) |
If the string is shorter than the offset, pads the right side of the string with spaces. |
|
substringAfter(string str, string separator) |
Gets the substring after the first separator. |
|
substringAfterLast(string str, string separator) |
Gets the substring after the last separator. |
|
substringBefore(string str, string separator) |
Gets the substring before the first separator. |
|
substringBeforeLast(string str, string separator) |
Gets the substring before the last separator. |
|
unwrap(string str, string wrapper) |
Returns a string without the wrapper text. The wrapper text is the value before and/or after a string. |
|
withMaxSize(string str, number size) |
Limits the size of a string. |
|
wrapIfMissing(string str, string wrapper) |
If a string is not wrapped, adds the wrapper at the beginning or end. If the wrapper already exists at the beginning or end, updates only the missing end. |
|
wrapWith(string str, string wrapper) |
Adds the wrapper at the beginning or end of a string. |
|
ordinalize(number num) |
Converts num to an ordered character string, for example, 1st, 2nd, or 3rd. |
|
appendIfMissing(string str, string value) |
If a string does not end with value, adds value there. |
|
prependIfMissing(string str, string value) |
If a string does not start with value, adds value there. |
|
repeat(string str, number times) |
Repeats the given number of times. |
|
Encryption and decryption (4) |
hash(string value, string algorithm) |
Calculates the hash value using a supported algorithm. The algorithm must be MD2, MD5, SHA-1, SHA-256, SHA-384 or SHA-512. |
hmac(string value, string secret, string algorithm) |
Generates a hash-based authentication code using the provided value, key, and hash function algorithm. The algorithm must be HMACSHA1, HMACSHA256, or HMACSHA512. |
|
encrypt(string value, string secret, string transformation) |
Encrypts the value using the specified JDK and key, and converts the encryption into a readable format using Base64. |
|
decrypt(string value, string secret, string algorithm, string mode, string padding) |
Decrypts the Base64 value using the specified JDK and key. |
|
Date and time (20) |
now() |
Returns the current date and time. |
compare(string datetime1, string datetime2) |
If datetime1 > datetime2, returns 1; if datetime1 < datetime2, returns -1; if datetime1 == datetime2, returns 0. |
|
atBeginningOfDay(string datetime) |
Returns the midnight time value of a given time. |
|
atBeginningOfHour(string datetime) |
Returns the given date and time, with minute and second as 0. |
|
atBeginningOfMonth(string datetime) |
Returns the first day of the month, with time as midnight. |
|
atBeginningOfWeek(string datetime) |
Returns the first day of the current week, with time as midnight. |
|
atBeginningOfYear(string datetime) |
Returns the first day of the year, with time as midnight. |
|
changeTimeZone(string datetime, string timezone) |
Changes the time zone, which usually results in a change in the local date and time. |
|
daysBetween(string datetime1, string datetime2) |
Returns the number of days between datetime1 and datetime2. |
|
format(string datetime, string outputFormat) |
Converts a given datetime into the specified format. |
|
isLeapYear(string datetime) |
Returns a Boolean value indicating whether datetime is a leap year. |
|
plus(string datetime, string period) |
Adds a date to a datetime. |
|
minus(string datetime, string period) |
Subtracts a date to a datetime. |
|
parse(string|number datetime, string inputFormat) |
Parses datetime using the input format and returns a value in the default format. If the epoch or timestamp value is used as the datetime, epoch or timestamp can be used as inputFormat. |
|
toLocalDate(string datetime) |
Localizes a date. |
|
toLocalDateTime(string datetime) |
Localizes a date and time. |
|
toLocalTime(string datetime, string format) |
Localizes a time. |
|
today() |
Returns the midnight time of the current day. |
|
tomorrow() |
Returns the midnight time of the next day. |
|
yesterday() |
Returns the midnight time of the previous day. |
|
Encoding and decoding (2) |
encode(string data, string encoding="UTF-8") |
Converts a string to the application/x-www-form-urlencoded format using the provided encoding scheme to obtain insecure bytes. The default encoding is UTF-8. |
decode(string data, string encoding="UTF-8") |
Decodes the application/x-www-form-urlencoded string using a specific encoding scheme to determine which characters are represented by a continuous sequence in the form of %xy. |
|
Number system conversion (9) |
fromBase64(string value) |
Converts a Base64 code to a value. |
toBase64(any value) |
Base64-encodes a value. |
|
fromHex(string value) |
Converts a hexadecimal number to a value. |
|
toHex(any value) |
Converts a value to a hexadecimal number. |
|
fromBinary(number value) |
Converts a value from binary to decimal. |
|
fromHex(number value) |
Converts a value from hexadecimal to decimal. |
|
fromRadixNumber(number value, number baseAsBinary) |
Converts a value to a decimal number. |
|
toBinary(number value) |
Converts a value from decimal to binary. |
|
toRadixNumber(number value, number baseAsDecimal) |
Converts a value to a specified number system. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot