How to create array from string separated by delimiter using vbscript split function
Suppose we have a string with value as : stringA = "nitin>joshi>qa>qtp>automation"
'' We can create an array using split function
Strarray = Split(StringA, ">")
'' we can loop through the array element using:
 intPropSet = Ubound(Strarray)  ''this gives the length or upper bound index of array.
  for i = 0 to intPropSet
      msgbox strarray(i)
  Next
''This can be useful to loop in validating multiple values ''e.g : Validating existence of multiple links with name as nitin or joshi or qtp or automation
''We can combine the values in an array using join statement
If (IsArray(Strarray)) then
   stringB = Join(Strarray, ">")
   msgbox "array with text: " + stringB
Else
   msgbox "not an array"
End If
So while understanding How to create array from string separated by delimiter using vbscript split function, we have now understanding of Join, split, IsArray,Ubound and lbound also
 
 
 
 
          
      
 
  
 
 
 
 
 
 
 
 
 
 
 
 
No comments:
Post a Comment