Micro Focus QTP (UFT) Forums
String Pattern : Alternet Character Capital - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: String Pattern : Alternet Character Capital (/Thread-String-Pattern-Alternet-Character-Capital)



String Pattern : Alternet Character Capital - abhideshpande001 - 09-01-2015

Hi, I need help from you guys.

Input String: abhijit abhijit
O/p String: aBhIjIt AbHiJiT

I need a script to get alternate character Capital. Big Grin


RE: String Pattern : Alternet Character Capital - supputuri - 09-02-2015

Quick Snippet
Code:
input = "abhijit abhijit"
For i  = 1 To len(input) Step 1
    If  i mod 2 = 0 Then
        outPut = output & Ucase(Mid(input,i,1))
    Else
        outPut = output & Mid(input,i,1)
    End If
    
Next

msgbox output



RE: String Pattern : Alternet Character Capital - abhideshpande001 - 09-02-2015

Thanks for Reply. But this code is not handling space. It should not consider space and should make next character Capital/Small

Input: a a a a
O/p: a A a A


RE: String Pattern : Alternet Character Capital - supputuri - 09-03-2015

here is the updated code.
Code:
input = "abhijit abhijit"
charCounter = 1
For i  = 1 To len(input) Step 1

    char = Mid(input,i,1)
    If char <> " " Then
        If  charCounter mod 2 = 0 Then
            outPut = output & Ucase(char)
    Else
            outPut = output & lcase(char)
    End If
        charCounter = charCounter + 1
    else
    output = output & char
    End If
Next

msgbox output
Note:- I have done it based on the pure requirement in this query. Ideally we have to check if the value is an alphabet and then change the case.


RE: String Pattern : Alternet Character Capital - abhideshpande001 - 09-03-2015

Thanks a Ton Smile