I am newbie in programming and would like to ask if I could separate the string below. I am using Visual Basic. Basically I have two string below :
String 1 : gOldStr= TEDDYBEARBLACKCAT
String 2 = gNewStr= BLACKCATWHITECAT
I wanted to separated the string 2 by looking the exact value in String 1
so that I have String2 that is part of string 1 = BLACKCAT
String 2 that is new = WHITECAT
I have tried below script but it doesn't work all the time. Could suggest me the better logic? Thanks2
For i=1 to Len(gOldStr)
TempStr = Left$(gNewStr,i)
Ctr1 = InStr(gOldStr, TempStr)
gTemporary = Mid$(gOldStr,Ctr1)
gTemporary = Trim(gTemporary)
Ctr2 = StrComp(gOldStr, gTemporary)
If Ctr2=1 Then
gTemporary2 = Replace(gNewStr,gTemporary,"")
Exit For
End If
Next i