String Formulas

Introduction

Sapper supports a variety of string formulas. Those are mentioned in this section.

Formulas

CONCATENATE

Description 

Concatenates two strings together 

Syntax 

Expression: CONCATENATE(String s1, String s2)

Return Type: String 

Example 

Expression: CONCATENATE(''Sapper'',''Software'') 

Result: SapperSoftware

STARTS

Description 

Checks if given string starts with string substring

Syntax 

Expression: STARTS(String s, String subStr) 

Return Type: Boolean

Example 

Expression: STARTS(''Sapper''',''Sa'') 

Result: true

REVERSE

Description 

Reverses the given string

Syntax 

Expression: REVERSE(String s)

Return Type: String

Example 

Expression: REVERSE(''Sapper'')

Result: reppaS

SUBSTRING

Description 

Returns a sub string from a given string with a specified range including the range limits

Syntax 

Expression: SUBSTRING(String s, int start, int end)

Return Type: String

Example 

Expression: SUBSTRING("Sapper",0,3)

Result: Sapp

CONTAINS

Description 

Checks if String s contains String subString in it

Syntax 

Expression: CONTAINS(String s, String subString)

Return Type: Boolean

Example 

Expression: CONTAINS(''Sapper'',''Software'')

Result: false

EXACT

Description 

Checks if the given strings are equals or not

Syntax 

Expression: EXACT(String s1, String s2)

Return Type: Boolean

Example 

Expression: EXACT(''Sapper'',''Software'')

Result: false

UPPER

Description 

Convert String from lower to upper case

Syntax 

Expression: UPPER(String s)

Return Type: String

Example 

Expression: UPPER(''Sapper'')

Result: SAPPER

LOWER

Description 

Convert String from upper to lower case

Syntax 

Expression: LOWER(String s)

Return Type: String

Example 

Expression: LOWER(''Sapper'')

Result: sapper

ISBLANK

Description 

Check the String is empty or null

Syntax 

Expression: ISBLANK(String s)

Return Type: Boolean

Example 

Expression: ISBLANK(''Sapper'')

Result: false

ENDS

Description 

Check the String ends with the given String

Syntax 

Expression: ENDS(String s, String subString)

Return Type: Boolean

Example 

Expression: ENDS('Sapper'',''Software'')

Result: false

TRIM

Description 

Removes whitespace from beginning and end of a given string

Syntax 

Expression: TRIM(String s)

Return Type: String

Example 

Expression: TRIM(" Sapper ")

Result: Sapper

SUBSTITUTE

Description 

Replace all the occurrences of the subPart from the main input string with the newString

Syntax 

Expression: SUBSTITUTE(String s, String subPart, String newString)

Return Type: String

Example 

Expression: SUBSTITUTE("Sapper","S","M")

Result: Mapper

SPLIT

Description 

Split the string based on given regex

Syntax 

Expression: SPLIT(String s, String regex)

Return Type: String

Example 

Expression: SPLIT('Hello World', ' ')

Result: [Hello, World]

Description 

Return the index of the specific character of string

Syntax 

Expression: SEARCH(String s, String toFind, String fromIndex)

Return Type: Integer

Example 

Expression: SEARCH("Sapper","per",1)

Result: 3

PROPER

Description 

Capitalizes the first letter in a text string and any other letters in the text that follow any character other than a letter

Syntax 

Expression: PROPER(String s)

Return Type: string

Example 

Expression: PROPER(''Sapper'')

Result: Sapper

BYTES

Description 

Returns an array of bytes of a given string

Syntax 

Expression: BYTES(Strings)

Return Type: Array [Integer]

Example 

Expression: BYTES(''hello'')

Result: [104, 101, 108, 108, 111]

MATCH

Description 

Check whether or not this string matches the given regular expression

Syntax 

Expression: MATCH(String s, String regex)

Return Type: Boolean

Example 

Expression: MATCH('Sapper',' ')

Result: false

IS_NOT_TRUE

Description 

Returns a boolean value and returns true if the evaluated value is not true

Syntax 

Expression: IS_NOT_TRUE(Object o)

Return Type: Boolean

Example 

Expression: IS_NOT_TRUE(''Sapper'')

Result: false

IS_TRUE

Description 

 Returns a boolean value and returns true if the evaluated value is true

Syntax 

Expression: IS_TRUE(Object o)

Return Type: Boolean

Example 

Expression: IS_TRUE(''Sapper'')

Result: true

EXCLUDE

Description 

Checks if the string contains a specific substring and returns false if it does

Syntax 

Expression: EXCLUDE(String s, String subString)

Return Type: Boolean

Example 

Expression: EXCLUDE(''Sapper'',''er'')

Result: false

REMOVESPECIALCHARS

Description 

Replaces special characters in a string

Syntax 

Expression: REMOVESPECIALCHARS(String s)

Return Type: String

Example 

Expression: REMOVESPECIALCHARS(''Sapper!'')

Result: Sapper

LSTRIP

Description 

Removes the white space at the beginning of the input string

Syntax 

Expression: LSTRIP(String s)

Return Type: String

Example 

Expression: LSTRIP('' Sapper''')

Result: Sapper

RSTRIP

Description 

Removes the white space at the end of the input string

Syntax 

Expression: RSTRIP(String s)

Return Type: String

Example 

Expression: RSTRIP(''Sapper'')

Result: Sapper

STRIP_TAGS

Description 

Removes HTML tags embedded in a string

Syntax 

Expression: STRIP_TAGS(String s)

Return Type: String

Example 

Expression: STRIP_TAGS('<div>Hello!</div>')

Result: Hello!

LJUST

Description 

The LJUST method is used to append the string.

Syntax 

Expression: LJUST(String inputString, char character, int length)

Return Type: String

Example 

Expression: LJUST("SAPPER","0",7) => SAPPER0

Result: LJUST("Sapper Software Pvt Ltd","0",7) => Sapper Software Pvt Ltd

RJUST

Description 

The RJUST method is used to prepend the string.

Syntax 

Expression: (String inputString, char character, int length)

Return Type: String

Example 

Expression: RJUST("SAPPER","0",7) => 0SAPPER

Result: RJUST("Sapper Software Pvt Ltd","0",7) => Sapper Software Pvt Ltd

SUB

Description 

Replaces the first occurrence of the first input value, with the second input value, within the string

Syntax 

Expression: SUB(String s1, String regex, String s2)

Return Type: String

Example 

Expression: SUB("Yapper","Y","S")

Result: Sapper

LENGTH

Description 

Returns the length of the string

Syntax 

Expression: LENGTH(String s)

Return Type: Integer

Example 

Expressin: LENGTH(''Sapper'')

Result: 6

SCAN

Description 

Scan the string for the pattern to retrieve and return an array

Syntax 

Expression: SCAN(String s, String pattern)

Return Type: Array [String]

Example 

Expression: SCAN(''Sapper'',''pper'')

Result: [pper]

ENCODE

Description 

Returns the string in a given encoding

Syntax 

Expression: ENCODE(String s, String encodingType)

Return Type: String

Example 

Expression: ENCODE("Hello","Windows-1252")

Result: SGVsbG8=

TRANSLITERATE

Description 

Replaces non-ASCII characters with an ASCII approximation, or if none exists, a replacement character which defaults to '?'

Syntax 

Expression: TRANSLITERATE(String s)

Return Type: String

Example 

Expression: TRANSLITERATE(''SapperÀ'')

Result: Sapper?

 

QUOTE

Description 

Converts string with single quote to double quotes.

Syntax 

Expression: QUOTE(String s)

Return Type: String

Example 

Expression: QUOTE("'S’u'n'")

Result: "S"u"n"

TO_S

Description 

Converts data to a string (text) datatype

Syntax 

Expression: TO_S(Object o)

Return Type: String

Example 

Expression: TO_S(''123'')

Result: 123

ORDINALIZE

Description 

Converts a number into an ordinal string used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th

Syntax 

Expression: ORDINALIZE(int n)

Return Type: String

Example 

Expression: ORDINALIZE('4')

Result: 4th

BYTESIZE

Description 

Returns the length of a given string in bytes

Syntax 

Expression: BYTESIZE(String s)

Return Type: Integer

Example 

Expression: BYTESIZE(''sapper'')

Result: 6