Jump to content

string difference


Recommended Posts

hi there...

I was trying to find a way to detect differences in strings...

ex:

string1 --> ababab

string2 --> ababbb

(the difference is the b in the 5 position)

but I can't figure it out

any suggestions ?

ps. I need to use the function on 2 lists of drives

thanks in advance

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

  • Developers

When its a matter of detecting 2 equal length strings and matching the same positions its quite easy. Just create a for-next loop comparing each position:

$s1 = "ababab"
$s2 = "ababbb"
For $x = 1 To StringLen($s1)
    If StringMid($s1,$x,1) <> StringMid($s2,$x,1) Then
        ConsoleWrite("There is a mismatch at position:" & $x & @CRLF)
    EndIf
Next

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

thanks Jos! :P

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...