Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
This tracks differences between two similar string...
Author:
Alexander Triantafyllou
E-mail:
Click to e-mail author
Submitted:
4/7/2003
Version:
VB4
Compatibility:
VB4, VB5, VB6
Category:
String Manipulation
Views:
11867
This tracks differences between two similar strings. For example "I AM LIVING IN ATHENS. GREETINGS" and "I AM LIVING IN LONDON. GREETINGS" will return "LONDON". Made by Alexander Triantafyllou alextriantf@yahoo.gr Feel free to use it where you want.
Declarations:
'none
Code:
Public Function trackchanges(input1 As String, input2 As String) As String 'this tracks differences between two similar strings 'for example "I AM LIVING IN ATHENS.GREETINGS" and ' "I AM LIVING IN LONDON.GREETINGS" will 'return "LONDON" 'made by Alexander Triantafyllou alextriantf@yahoo.gr 'feel free to use it where you want ' ' 'if you like it vote for it 'Greetings from Athens - Greece pastedstr = "" spos = 1 fpos = 1 Do While spos < Len(input1) floko = Mid(input1, spos, 1) fluki = Mid(input2, fpos, 1) If floko = fluki Then spos = spos + 1 fpos = fpos + 1 Else Exit Do End If Loop epos = Len(input1) flupos = Len(input2) Do While epos > spos floko = Mid(input1, epos, 1) fluki = Mid(input2, flupos, 1) If fluki = floko Then epos = epos - 1 flupos = flupos - 1 Else Exit Do End If Loop If flupos = 0 Then trackchanges = input1 Else trackchanges = Mid(input2, spos, flupos - spos + 1) End If End Function
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement