String methods are used to perform operations on strings and data manipulation. The following operations will be covered in the sterlo smart code.
- Length
- Slice
- SubString
- Substr
- Replace
- ToUpperCase
- ToLowerCase
- Trim
- Concat
- ToString
- CharAt
- Split
- Pascal Case
- Camel Case
- First Letter Capital
Length
This will return the length of the given string.
Syntax
length(variablename,value)
Parameters
- variablename(Required) – name of the variable to store the length of the given string
- value(Required) – String to calculate the length
Direct Code
var <<variablename>> =await Orefuncs.stringMethods(“length”, “<<value>>”, “”, “”)
Slice
This method is used to extract the given string and will return the extracted string.
Syntax
slice(variablename,value,Param1,Param2)
Parameters
- variablename(Required) – Name of the variable to store the extracted string of the given string
- value(Required) – The string value to extract
- Param1(Required) – The start position of the string
- Param2(Required) – End position of the string
Direct Code
var <<variablename>> =await Orefuncs.stringMethods(“slice”, “<<value>>”, “<<Param1>>”, “<<Param2>>”)
SubString
The SubString is same as Slice. The only difference is the start(Param1) and end(Param2) values less than 0 are treated as 0.
Syntax
slice(variablename,value,Param1,Param2)
Parameters
- variablename(Required) – Name of the variable to store the extracted string of the given string
- value(Required) – The string value to extract
- Param1(Required) – The start position of the string
- Param2(Required) – End position of the string
Direct Code
var <<variablename>> =await Orefuncs.stringMethods(“slice”, “<<value>>”, “<<Param1>>”, “<<Param2>>”)
Substr
The difference is that the second parameter specifies the length of the extracted part.
Syntax
substr(variablename,value,Param1,Param2)
Parameters
- variablename(Required) – name of the variable to store the extracted string of the given string
- value(Required) – To specify the length of the part.
- Param1(Required) – The start position of the string
- Param2(Required) – End position of the string
Direct Code
var <<variablename>> =await Orefuncs.stringMethods(“substring”, “<<value>>”, “”, “”)
Replace
a specified value will be replace with another value in a string.
Syntax
replace(variablename,value,Param1,Param2)
Parameters
- variablename(Required) – name of the variable to store the extracted string of the given string
- value(Required) – To specify value with another value in a string
- Param1(Required) – The start position of the string
- Param2(Required) – End position of the string
Direct Code
var <<variablename>> =await Orefuncs.stringMethods(“replace”, “<<value>>”, “”, “”)
ToUpperCase
Method defines a string is converted to upper case.
Syntax
toUpperCase(variablename,value)
Parameters
- variablename(Required) – name of the variable to store the extracted string of the given string
- value(Required) – To specifies value in a string
Direct Code
var <<variablename>> =await Orefuncs.stringMethods(“toUpperCase”, “<<value>>”)
ToLowerCase
Method defines a string is converted to lower case.
Syntax
toLowerCase(variablename,value)
Parameters
- variablename(Required) – name of the variable to store the extracted string of the given string
- value(Required) – To specifies value in a string
Direct Code
var <<variablename>> =await Orefuncs.stringMethods(“toLowerCase”, “<<value>>”)
Trim
Method defines a removes whitespace from both sides of a string
Syntax
trim(variablename,value)
Parameters
- variablename(Required) – name of the variable to store the extracted string of the given string
- value(Required) – To specifies value in a string
Direct Code
var <<variablename>> =await Orefuncs.stringMethods(“trim”, “<<value>>”)
Concat
Method defines to joins two or more strings
Syntax
Concat(variablename,value,Param1)
Parameters
- variablename(Required) – name of the variable to store the extracted string of the given string
- value(Required) – To specifies value in a string
- Param1(Required) – The position of the string
Direct Code
var <<variablename>> =await Orefuncs.stringMethods(“Concat”, “<<value>>”,””)
ToSting
Method defines converting the number to a string.
Syntax
toString(variablename,value)
Parameters
- variablename(Required) – name of the variable to store the extracted string of the given string
- value(Required) – To specifies value in a string
Direct Code
var <<variablename>> =await Orefuncs.stringMethods(“toString”, “<<value>>”)
CharAt
Method defines returns the character at a specified index (position) in a string.
Syntax
charAt(variablename,value,Param1)
Parameters
- variablename(Required) – name of the variable to store the extracted string of the given string
- value(Required) – To specifies value in a string
- Param1(Required) – The position of the string
Direct Code
var <<variablename>> =await Orefuncs.stringMethods(“charAt”, “<<value>>”,””)
Split
Method defines a string that can be converted to an array
Syntax
split(variablename,value,Param1,Param2)
Parameters
- variablename(Required) – name of the variable to store the extracted string of the given string
- value(Required) – To specifies value in a string
- Param1(Required) – The start position of the string
- Param2(Required) – End position of the string
Direct Code
var <<variablename>> =await Orefuncs.stringMethods(“split”, “<<value>>”,””,””)
Pascal Case
Method defines a starts out lowercase with each word delimited by a capital letter.
Syntax
pascalcase(variablename,value)
Parameters
- variablename(Required) – name of the variable to store the extracted string of the given string
- value(Required) – To specifies value in a string
Direct Code
var <<variablename>> =await Orefuncs.stringMethods(“pascalcase”, “<<value>>”)
Camel Case
Method defines the first letter is always capitalized.
Syntax
camelcase(variablename,value)
Parameters
- variablename(Required) – name of the variable to store the extracted string of the given string
- value(Required) – To specifies value in a string
Direct Code
var <<variablename>> =await Orefuncs.stringMethods(“camelcase”, “<<value>>”)
First Letter Capital
Method defines a string that can be converted to the first letter to a capital.
Syntax
fcaptial(variablename,value)
Parameters
- variablename(Required) – name of the variable to store the extracted string of the given string
- value(Required) – To specifies value in a string
Direct Code
var <<variablename>> =await Orefuncs.stringMethods(“fcaptial”, “<<value>>”)