Jump to content

Recommended Posts

Posted (edited)

Hi,

i did this to learn AutoIT bit more but wOuter told me its a bit faster then the other one so here it is:

Func StringReverse( $s_string ) 
    Local $string
    If StringLen($sString) >= 1 Then
        Local $split = StringSplit( $s_string , '' ) 
        
        For $b = $split[0] to 1 Step -1 
            $string &= $split[$b] 
        Next 
        Return $string 
    Else
        SetError(1)
        Return ""
    EndIf
EndFunc
Edited by Daniel W.

--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Posted

wOuter did it

[16:24] M-3vent | *HardCore*  < 1 + 3 + 3 = 7 >: _StringReverse: 3136.18157484187 
StringReverse_Mine: 3153.86767657846 
StringReverse_Dan: 2469.65613484093 
[16:24] M-3vent | *HardCore*  < 1 + 3 + 3 = 7 >: using the same errorhandeling as in _StringReverse

:D

--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Posted

If you want it really fast you can strip out things like error checking etc. this will make it fly.

Func StringReverse( $s_string ) 
     Global $string
     Local $split = StringSplit( $s_string , '' ) 
        
     For $b = $split[0] to 1 Step -1 
         $string &= $split[$b] 
     Next 
EndFunc
Posted

Thats not what i want ...

I just want a function that does the same but that i made. The faster speed is just something that happened without my idea :D

--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

  • Developers
Posted

If you want it really fast you can strip out things like error checking etc. this will make it fly.

Is this statement based on a test or guess? would surprise me if a bit of error checking at the beginning would even be measurable....

Thats not what i want ...

I just want a function that does the same but that i made. The faster speed is just something that happened without my idea :D

My guess is that the real reason for this version to be faster is because of the usage of &=, which make "added on to a string" faster......

Before the separation of the Production and Beta includes we tried to make the UDF's work in both versions so this wasn't an option... now it is...

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.
  :)

Posted

I have rewritten some other string functions and noticed that StringTrimRight/Left takes "much" time , so it mustn't be &= ...

--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

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
  • Recently Browsing   0 members

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