String Functions
• | split |
• | join |
• | ljust |
• | rjust |
split(<string>, separator <string>|<regex>)
split splits a string on separator. Separator may be a string or a regular expression. split returns an array of strings. split may appear when defining datasource fields or in validations.
Examples:
split("us-east-1a", "-") # returns ["us","east","1a"]
split("a, b, c", /\s*,\s*/) # returns ["a","b","c"]
join(<array of strings>, separator <string>)
join joins a string with a separator. Separator must be a string. join always returns a string. join may appear when defining datasource fields or in validations.
Example:
join(["us","east","1a"], "-") # returns "us-east-1a"
ljust(<string>, length <number>, padder <string>)
ljust left justifies a string by filling it with the padder until it meets a minimum length. ljust always returns a string. ljust may appear when defining datasource fields or in validations.
Example:
ljust("foo", 10, "-=") # returns "foo-=-=-=-"
rjust(<string>, length <number>, padder <string>)
rjust right justifies a string by filling it with the padder until it meets a minimum length. rjust always returns a string. rjust may appear when defining datasource fields or in validations.
Example:
rjust("foo", 10, "-=") # returns "=-=-=-=foo"