Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Identifying differences between two character strings
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00806505
Message ID:
00807531
Views:
15
Depending on the exact requirements this may work
funtion StrDiff(tc1,tc2)
local lcdiff,lc1,lc2
lcdiff = ''
if vartype(tc1) = 'C' and vartype(tc2) = 'C'
  if len(tc1) > len(tc2)
    lc1 = tc1
    lc2 = tc2
  else
    lc1 = tc2
    lc2 = tc1
  endif
  lcdiff = strtran(lc1,lc2,space(len(lc2)))
endif
return lcDiff
Glenn


if
>Does anyone know of an existing function, routine, or 3rd-pary product that will show the differences between one character string and another? I'm not totally sure exactly how this would work, but one example follows:
>Original string = "The cat jumped over the fence."
>New string = "The cat jumped over the fence to cross the road."
>Routine would return something like: "to cross the road."
>Etc...
>
>Thanks!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform