Difference between two strings in VBScript -
i need way find difference between 2 strings in windows application using vbscript
. 1 of strings known second 1 unknown during coding. know there functions strcompare
, instr
etc. these require know second string during coding.
explanation:
there text box in screen , there several buttons in same screen. , when buttons clicked, text in text box changes depending on button clicked. there way find changes made text after button clicked ? need text entered due button click. there simple way or requires complex coding ?
thanks in advance.
it depends on application , format of new string.
if need find text appended original string, take new text , replace first occurrence of original string empty string:
dim strold, strnew, strdiff strold = "apple" strnew = "apple, orange" strdiff = replace(strnew, strold, "", 1, 1) wscript.echo strdiff
sample output:
, orange
or if need appended text without preceding comma, use this:
strdiff = replace(strnew, strold + ", ", "", 1, 1)
Comments
Post a Comment