golfinhu Posted September 21, 2010 Posted September 21, 2010 hi guys, I needed a function to reverse a string, I got to do this until it works: Func _Revert_text($text) Local $count = StringLen($text) If $count = 0 Then Return Local $a = 0 Local $newstring = "" For $i = $count To 1 Step -1 Local $letter = StringMid($text, $count - $a, 1) $newstring = $newstring & $letter $a += 1 Next Return $newstring EndFunc ;==>_Revert_text But I think it was poorly done, is there another way to do? thanks
Realm Posted September 21, 2010 Posted September 21, 2010 (edited) How about _StringReverse($text) Edit: Change the parameter to suit your need Edited September 21, 2010 by Realm My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry.
golfinhu Posted September 21, 2010 Author Posted September 21, 2010 oh, did not know this function! thanks!
Realm Posted September 21, 2010 Posted September 21, 2010 My pleasure, I had the time My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry.
smashly Posted September 21, 2010 Posted September 21, 2010 Hi, I know it's already been solved, but the op was so close to reinventing the wheel.ConsoleWrite(_Revert_text("Reverse this string") & @LF) Func _Revert_text($text) Local $aSS = StringSplit($text, ""), $sTmp For $i = $aSS[0] To 1 Step -1 $sTmp &= $aSS[$i] Next Return $sTmp EndFunc ;==>_Revert_text
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now