有两个字符串A,B,
现在对这两个字符串进行比较,如是A与B不同,则以A为参考,将B中与A不同的内容全部取出,不知道各位有好的算法吗?

解决方案 »

  1.   

    dim l_minlength as integer
    dim I as integet
    dim c as stringif len(A)<len(B) then
      l_minlength=len(A)
    else
     l_minLength=Len(B)
    endiffor i=1 to l_minlength
       if mid(A,i)<>mid(B,i) then
          c=c&mid(B,i)
       endif
    next iif len(B)>l_minlength then
       for i=l_minlength to Len(B)
            c=c&mid(B,i)
       next i
    endif
      

  2.   

    to  LeoFly() :
    有个问题?
    if mid(A,i)<>mid(B,i) then
          c=c&mid(B,i)
      endif
    这儿写错了吧?
    应该是吧,一个个的进行对比吧?
    if mid(A,i,1)<>mid(B,i,1) then
          c=c&mid(B,i,1)
      endif