String Functions : Function Index

Description : String functions are used to manipulate any string in the script in the runtime.

Where the String Functions can be used ?

Following are scenario where the string functions can be used,

How to insert string functions in the script ?
Following are the various functions available in the String Functions category,
  1. endsWith
  2. indexOf
  3. length
  4. replaceAll
  5. replaceFirst
  6. split
  7. startsWith
  8. subString
  9. toLowerCase
  10. toUpperCase

endsWith

 Function Description:

 Use this function to check whether the specified String ("String_Value") ends with the specified end string value.

 How to Define:

 endsWith("String_Value","End_String_Value")

Example:

          endsWith("AdventNet","Net")

          In the above case, the string "AdventNet" will be verified whether it ends with "Net".

Return Values:

 0 for Success

1 for Failure

 Top


indexOf

 Function Description:

 Use this function to get the index within this string ("String_Value") of the first occurrence of the specified pattern string.

 How to Define:

 indexOf("String_Value","Pattern_String")

Example:

          indexOf("AdventNet","Net")

          In the above case, the start position of "Net" in the string "AdventNet" will be verified and the index will be returned. In this example it will return 6.
          If the given "Pattern_String" not present then "-1" will be returned.

Return Values:

 Integer - the start position of the given Pattern_String in the given string.

 Top


length

 Function Description:

Use this function to get the length of the given string.

 How to Define:

 length("String_Name")

 Example:

          length("AdventNet")

          In the above case, the length of the word "AdventNet" will be obtained and will be returned. In this example case "9" will be returned.

Return Values:

 Integer - the length of the given string.

 Top


replaceAll

 Function Description:

 Use this function to replace each substring of this string that matches the given search pattern with the given replace string.

 How to Define:

 replaceAll("String_Value","Search_Pattern","Replace_String")

 Example:

          replaceAll("AdventNet","e","a")

          In the above case, each letter "e" will be replaced with letter "a" and the resulting string will be returned from this function. For this example, the resultant string will be "AdvantNat".

 Return Values:

 String - the replaced string.

 Top


replaceFirst

 Function Description:

 Use this function to replace the  first substring of this string that matches the given search pattern with the  given replace string.

 How to Define:

 replaceFirst("String_Value","Search_Pattern","Replace_String")

 Example:

          replaceFirst("AdventNet","e","a")

          In the above case, first occurence of letter "e" will be replaced with letter "a" and the resulting string will be returned from this function. For this example, the resultant string will be "AdvantNet".

Return Values:

 String - the replaced string

 Top


split

 Function Description:

 Use this function to split the given string with the given separator.

 How to Define:

 split("String_Value","Separator")

 Example:

          split("Advent-Net","-")

          In the above case, the given string will be splited with "-" separator and an array will be returned after spliting the value. For this example, the resultant will be {"Advent","Net"}.

Return Values:

 String Array - containing the splited string in the array.

 Top


startsWith

 Function Description:

 Use this function to verify whether the string starts with the specified start string value.

 How to Define:

 startsWith("String_Value","Start_String_Value")

Example:          

          startsWith("AdventNet","Advent")

          In the above case, the given string "AdventNet" will be verified whether it starts with "Advent". For this example it will return "0".

Return Values:

 0 for Success

1 for Failure

 Top


subString

 Function Description:

 Use this function to returns a new string that is a substring of this string.

 How to Define:

 subString("String_Value","Start_Index","End_Index")

Example:          

          subStrnig("AdventNet","6","9")

          In the above case, in the given string the new string will be formed from the 6th to 9th index in the string. For this example, the return value will be "Net".

 Return Values:

 String - the substring from the original string.

 Top


toLowerCase

 Function Description:

 Use this function to convert the specified string to lowercase.

 How to Define:

 toLowerCase("String_Value")

Example:          

          toLowerCase("AdventNet")

          In the above case, all the letters in the word will be lower cased and returned. For this example, it will return "adventnet".

 Return Values:

 String - all the letters in the lowercase of the given string.

 Top


toUpperCase

 Function Description:

 Use this function to convert the specified string to uppercase.

 How to Define:

 toUpperCase("String_Value")

Example:          

          toUpperCase("AdventNet")

          In the above case, all the letters in the word will be upper cased and returned. For this example, it will return "ADVENTNET".

 
Return Values:

 String - all the letters in the uppercase of the given string.

 Top


 



Copyright © 1999, AdventNet Inc. All Rights Reserved.