UFT- Reverse string or line without in build functions such as strReverse or Mid
Dim Arr2(0)
'Input sting
sKey="Reverse string or line without inbuilt functions such as strReverse or Mid"
'Array to keep individual strings
Arr1= split (sKey, " ")
k=ubound(Arr1)
For i = 0 To K
'Store the single string in an array
Arr2(0)=Arr1(i)
sKey1=Arr2(0)
'Store the single string characters in a an array
Set oRegExp= New RegExp
oRegExp.Global = True
oRegExp.Pattern = ".{1}"
Set col=oRegExp.Execute(sKey1)
For l = 0 To col.Count-1
ReDim Preserve Arr3(l)
Arr3(l)=col.Item(l)
Next
'Store the reversed single string
For j = ubound(Arr3) To 0 Step -1
rev=rev & Arr3(j)
Next
'String the reversed whole input string
rev = rev & " "
Next
print (rev)
Set oRegExp=Nothing
Set col =Nothing
Dim Arr2(0)
'Input sting
sKey="Reverse string or line without inbuilt functions such as strReverse or Mid"
'Array to keep individual strings
Arr1= split (sKey, " ")
k=ubound(Arr1)
For i = 0 To K
'Store the single string in an array
Arr2(0)=Arr1(i)
sKey1=Arr2(0)
'Store the single string characters in a an array
Set oRegExp= New RegExp
oRegExp.Global = True
oRegExp.Pattern = ".{1}"
Set col=oRegExp.Execute(sKey1)
For l = 0 To col.Count-1
ReDim Preserve Arr3(l)
Arr3(l)=col.Item(l)
Next
'Store the reversed single string
For j = ubound(Arr3) To 0 Step -1
rev=rev & Arr3(j)
Next
'String the reversed whole input string
rev = rev & " "
Next
print (rev)
Set oRegExp=Nothing
Set col =Nothing
No comments:
Post a Comment