HOWTO return the difference between two strings?
Author |
Message |
Bas Cost Budd #1 / 7
|
 HOWTO return the difference between two strings?
I want to do a scan in program code to see whether there were changes (that I forgot to document, yes indeed). Or just to see what I've done in a certain project, supposing I kept the original file of course. I know how to navigate all these objects. But I want to do the following: supply two strings to a function return the parts that are only in one string, or only in the other, I think as ByRef parameters (I'd like the function result to be a boolean, or an Integer) I remember there is a DOS utility that does just this. But when trying to design an algorithm, I got quite stuck in the possibilities. Anyone done this? -- Thank you. Regards, Bas Cost Budde, Holland website at http://www.*-*-*.com/ email at the same domain as utopia, but I don't like spam
|
Tue, 10 Jun 2003 04:38:53 GMT |
|
 |
Michel Wals #2 / 7
|
 HOWTO return the difference between two strings?
Hi, The specs are not very clear, but I will say that a replace of the shortest string into the longest one with vbNullString can implement a possible INTERPRETATION of your description: ? Replace("This is a string with agagaga in it, and indeed there is the word agagaga in this string.", "agagaga" , vbNullString,,,vbBinaryCompare) This is a string with in it, and indeed there is the word in this string. Replace is available in VB6/VBA6. You can consult "VBA Developers Handbook" for a very good implementation of it if you are using a less recent version. Hoping it may help, Vanderghast, Access MVP
Quote: > I want to do a scan in program code to see whether there were changes (that > I forgot to document, yes indeed). Or just to see what I've done in a > certain project, supposing I kept the original file of course. > I know how to navigate all these objects. But I want to do the following: > supply two strings to a function > return the parts that are only in one string, or only in the other, I think > as ByRef parameters (I'd like the function result to be a boolean, or an > Integer) > I remember there is a DOS utility that does just this. But when trying to > design an algorithm, I got quite stuck in the possibilities. Anyone done > this? > -- > Thank you. Regards, > Bas Cost Budde, Holland > website at http://utopia.knoware.nl/users/hegedu > email at the same domain as utopia, but I don't like spam
|
Tue, 10 Jun 2003 19:22:39 GMT |
|
 |
Hans-Chr. Franck #3 / 7
|
 HOWTO return the difference between two strings?
There is a custom replace function available at www.master-office.com under "Developers" if you don't have one already. -- Regards Hans-Chr. Francke www.master-office.com
Quote: > Hi, > The specs are not very clear, but I will say that a replace of the shortest > string into the longest one with vbNullString can implement a possible > INTERPRETATION of your description: > ? Replace("This is a string with agagaga in it, and indeed there is the word > agagaga in this string.", "agagaga" , vbNullString,,,vbBinaryCompare) > This is a string with in it, and indeed there is the word in this string. > Replace is available in VB6/VBA6. You can consult "VBA Developers Handbook" > for a very good implementation of it if you are using a less recent version. > Hoping it may help, > Vanderghast, Access MVP
> > I want to do a scan in program code to see whether there were changes > (that > > I forgot to document, yes indeed). Or just to see what I've done in a > > certain project, supposing I kept the original file of course. > > I know how to navigate all these objects. But I want to do the following: > > supply two strings to a function > > return the parts that are only in one string, or only in the other, I > think > > as ByRef parameters (I'd like the function result to be a boolean, or an > > Integer) > > I remember there is a DOS utility that does just this. But when trying to > > design an algorithm, I got quite stuck in the possibilities. Anyone done > > this? > > -- > > Thank you. Regards, > > Bas Cost Budde, Holland > > website at http://utopia.knoware.nl/users/hegedu > > email at the same domain as utopia, but I don't like spam
|
Tue, 10 Jun 2003 22:30:37 GMT |
|
 |
Bas Cost Budd #4 / 7
|
 HOWTO return the difference between two strings?
Thanks to both of you. I will readily admit that my specs are vague. But although good for another idea, I cannot really use this answer. Scenario: I have a database. I create a copy of it, in which I make changes. Many changes do not interest me. But changes in code modules, to begin with, and possibly later in form code too, needs my attention. So, I want to see whether code has changed. I can make out for myself if a procedure has ceased, or been born; but if it exists both in the original and modified version, chances are that it has changed. I imagine a two-column output, both procedures each in their own column; on each row, a line of code is either present or absent. The result of this is a clear visual clue as to what has happened to the code. My first problem arose when I realized that it can be difficult to see where the start of the code is. I mean, maybe there [stops suddenly, thinking] I think I just answered that part: the start of the code, that is the one to look in, is the original of course. Challenge is to write something that does not rely on this assumption, but that is not necessary now. I think I can write this now. Thinking aloud often helps. So then, thanks for listening. With this description at hand, did you ever see such a thing before? -- Thank you. Regards, Bas Cost Budde, Holland website at http://utopia.knoware.nl/users/hegedu email at the same domain as utopia, but I don't like spam Quote:
>There is a custom replace function available at www.master-office.com under >"Developers" if you don't have one already.
>> The specs are not very clear, but I will say that a replace of the >shortest >> string into the longest one with vbNullString can implement a possible >> INTERPRETATION of your description:
|
Wed, 11 Jun 2003 04:05:00 GMT |
|
 |
Michel Wals #5 / 7
|
 HOWTO return the difference between two strings?
Hi, in C and C++, yes, but VB is terrible with strings... Furthermore, it is very hard if both copies have add a line: Public Sub A() Public Sub A() MyFirstLine MyFirstLine MyThirdLIne SomeOtherLineHere MyFourthLIne YetAnotherLine End Sub MyFourthLine End Sub it is simple to see where both start to differ, but it is hard to detect where they merge again to the same path (note this is a simple scenario, starting from the End Sub and going up won't help much in a real case). If I have saw something like that, yes, Visual Safe Source ( but I don't use it anymore) and FMS inc has a tool for that too. Vanderghast, Access MVP
Quote: > Thanks to both of you. I will readily admit that my specs are vague. But > although good for another idea, I cannot really use this answer. > Scenario: > I have a database. I create a copy of it, in which I make changes. Many > changes do not interest me. But changes in code modules, to begin with, and > possibly later in form code too, needs my attention. So, I want to see > whether code has changed. I can make out for myself if a procedure has > ceased, or been born; but if it exists both in the original and modified > version, chances are that it has changed. > I imagine a two-column output, both procedures each in their own column; on > each row, a line of code is either present or absent. The result of this is > a clear visual clue as to what has happened to the code. > My first problem arose when I realized that it can be difficult to see where > the start of the code is. I mean, maybe there [stops suddenly, thinking] I > think I just answered that part: the start of the code, that is the one to > look in, is the original of course. Challenge is to write something that > does not rely on this assumption, but that is not necessary now. > I think I can write this now. Thinking aloud often helps. So then, thanks > for listening. > With this description at hand, did you ever see such a thing before? > -- > Thank you. Regards, > Bas Cost Budde, Holland > website at http://utopia.knoware.nl/users/hegedu > email at the same domain as utopia, but I don't like spam
> >There is a custom replace function available at www.master-office.com under > >"Developers" if you don't have one already.
> >> The specs are not very clear, but I will say that a replace of the > >shortest > >> string into the longest one with vbNullString can implement a possible > >> INTERPRETATION of your description:
|
Wed, 11 Jun 2003 06:13:55 GMT |
|
 |
David Whitmor #6 / 7
|
 HOWTO return the difference between two strings?
Yes, both do compare. Neither will do exactly what you want though. Perhaps with some modification/combination of their abilities you can achieve your goals. You might also check out some of the AI programs, natural language or neural network. David Whitmore Quote:
> Hi, > in C and C++, yes, but VB is terrible with strings... > Furthermore, it is very hard if both copies have add a line: > Public Sub A() Public Sub A() > MyFirstLine MyFirstLine > MyThirdLIne SomeOtherLineHere > MyFourthLIne YetAnotherLine > End Sub MyFourthLine > End Sub > it is simple to see where both start to differ, but it is hard to detect > where they merge again to the same path (note this is a simple scenario, > starting from the End Sub and going up won't help much in a real case). > If I have saw something like that, yes, Visual Safe Source ( but I don't use > it anymore) and FMS inc has a tool for that too. > Vanderghast, Access MVP
> > Thanks to both of you. I will readily admit that my specs are vague. But > > although good for another idea, I cannot really use this answer. > > Scenario: > > I have a database. I create a copy of it, in which I make changes. Many > > changes do not interest me. But changes in code modules, to begin with, > and > > possibly later in form code too, needs my attention. So, I want to see > > whether code has changed. I can make out for myself if a procedure has > > ceased, or been born; but if it exists both in the original and modified > > version, chances are that it has changed. > > I imagine a two-column output, both procedures each in their own column; > on > > each row, a line of code is either present or absent. The result of this > is > > a clear visual clue as to what has happened to the code. > > My first problem arose when I realized that it can be difficult to see > where > > the start of the code is. I mean, maybe there [stops suddenly, thinking] I > > think I just answered that part: the start of the code, that is the one to > > look in, is the original of course. Challenge is to write something that > > does not rely on this assumption, but that is not necessary now. > > I think I can write this now. Thinking aloud often helps. So then, thanks > > for listening. > > With this description at hand, did you ever see such a thing before? > > -- > > Thank you. Regards, > > Bas Cost Budde, Holland > > website at http://utopia.knoware.nl/users/hegedu > > email at the same domain as utopia, but I don't like spam
> > >There is a custom replace function available at www.master-office.com > under > > >"Developers" if you don't have one already.
> > >> The specs are not very clear, but I will say that a replace of the > > >shortest > > >> string into the longest one with vbNullString can implement a possible > > >> INTERPRETATION of your description:
|
Wed, 11 Jun 2003 11:43:46 GMT |
|
 |
Bas Cost Budd #7 / 7
|
 HOWTO return the difference between two strings?
Still many thanks. They are fruitful attributions. I will come up with whatever I will have made (put it on my site!) -- Thank you. Regards, Bas Cost Budde, Holland website at http://utopia.knoware.nl/users/hegedu email at the same domain as utopia, but I don't like spam Quote:
> Hi, > in C and C++, yes, but VB is terrible with strings... > Furthermore, it is very hard if both copies have add a line: > If I have seen something like that, yes, Visual Safe Source ( but I don't use > it anymore) and FMS inc has a tool for that too.
>Yes, both do compare. Neither will do exactly what you want though. Perhaps with >some modification/combination of their abilities you can achieve your goals. You >might also check out some of the AI programs, natural language or neural >network.
good remark. That was a strong point in my study, too.
|
Wed, 11 Jun 2003 18:55:10 GMT |
|
|
|