QTP code -Basic String Manipulation











Sponsored Links:


Basic functions for string manipulation.
.
.
.
.
.
.
.
.
.
.
.
.
.
Function: String
Accepts a number and a character. Returns a string created with the character that is repeated the given number of times.
' exampleMsgBox 
String(5,"A")


Function: Len
Returns the number of characters from a given string.' example
strMyName = "Joe Bloggs"
MsgBox "The Name '" & strMyName & "' is " & Len(strMyName& " characters long"


Function: Instr
Accepts two strings and returns True if the second string is contained within the first.' example
If Instr("Hello, welcome to www.QTPHelper.com!""QTP")>0 Then MsgBox "Found"


Function: Left
Returns the given number of left-most characters from a string' example
MsgBox Left("Joe Bloggs"3)


Function: Right
Returns the given number of right-most characters from a string' example
MsgBoxRight("Joe Bloggs"6)


Function: LCase
Returns a given string in lower-case' example
MsgBox LCase("JoE BloGGs")


Function: UCase
Returns a given string in upper-case' example
MsgBox UCase("joe bloggs")

Source: https://qtphelper.com

0 comments: