This page outlines the string operations you can perform using NetScript.
'string'
This function returns the string literal. Delimiter is single quote. Single quotes are not supported in string literals.
Function: 'string'
Data Type: string
Example:
'hello world'
hello world
'string1 + string2'
This function returns the string concatenation of the input .
Function: string1 + string2
Data Type: string
Example:
'hello + world'
'string1 in string2'
This function returns a boolean statement indicating whether string1 is a substring of string2.
Function: string1 in string2
Data Type: boolean
Example:
'fruit' in 'Bowl of fruit'
'fruit' in 'Bowl of vegetables'
'string1 contains string2'
This function returns a boolean statement indicating whether string2 is a substring of string1.
Function: string1 contains string2
Data Type: boolean
Example:
'fruit' contains 'it'
'fruit' contains 'Bowl of fruit'
to_string(input)
This function returns the input cast to string. Input can be any value.
Function: to_string(input)
Data Type: string
Example:
to_string(5)
5
lowercase
This function converts string values to lower case.
Function: lowercase
Data Type: string
Example:
lowercase('HELLO')
hello
regexp_instr
This function returns the lowest 1-based position of the substring in string that matches the regexp. 1st arg is the string to search in, 2nd arg is the regex to match. Returns null if either arg is null, throws error if the regex string is invalid, returns 0 if there is no match.
Function: regexp_instr
Data Type: string
Example:
regexp_instr(‘abc1’, ‘[0-9]’)
4
regexp_substr
This function returns the first substring that matches the regex. 1st arg is the string to search in, 2nd arg is the regex to match. Returns null if either arg is null or if there is no match, throws error if the regex string is invalid.
Function: regexp_substr
Data Type: string
Example:
regexp_substr(‘abc1’, ‘[0-9]’)
1
regexp_count
This function returns the number of times that a pattern (2nd arg) occurs in a string (1st arg).
Function: regexp_count
Data Type: string
Example:
regexp_count('abracadabra', 'bra')
2
regexp_replace
This function returns the subject (1st arg) with all occurrences of the pattern (2nd arg), replaced by a replacement string (3rd arg). If no matches are found, returns the original subject.
Function: regexp_replace
Data Type: string
Example:
regexp_replace('abc123', '[0-9]*', '_number')
abc_number
strlen
This function returns the number of characters in the given string.
Function: strlen
Data Type: string
Example:
strlen('hello')
5
trim
This function removes leading and trailing whitespace from a string.
Function: trim
Data Type: string
Example:
trim(' a ')
'a'
Please sign in to leave a comment.