Sign in to follow this  
Followers 0
FuryCell

UDF : _StringRotate()

5 posts in this topic

#1 ·  Posted (edited)

Here is a UDF I just made. It is rotates a string either left or right by a specified number of places.

Here is the Header:

;===============================================================================
;
; Description:    Rotates a string
; Syntax:          _StringRotate($sString, $iDir = 1, $iPlaces = 1)
;
; Parameter(s):     $sString = The string to rotate
;                  $iDir = The direction to rotate the string. (Right = 1,Left = -1)
;                  $iPlaces = The number of places to rotate the string
;
; Requirement(s):   None
; Return Value(s):  On Success - Returns the rotated string.
;                   On Failure - Returns an empty string "" and sets @Error on errors
;                       @Error=1 $sString length equals 0
;                       @Error=2 $iDir is invalid (must be 1 or -1)
;                      @Error=3 $iPlaces is invalid (must be an integer greater than 0)
;
; Author(s):        SolidSnake <MetalGearX91@Hotmail.com>
; Note(s):          None
;===============================================================================

For example:

_StringRotate("ABCDEFGHIJKLMNOPQRSTUVWXYZ",1,1)

would return "ZABCDEFGHIJKLMNOPQRSTUVWXY"

Please let me know what you think of it.

-SolidSnake

Edit:Changed header to reflect my new email address.(Previous Downloads 51)

StringRotateExample.au3

Edited by P5ych0Gigabyte

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites



_StringReverse

But your function specifys how many characters to rotate :) Very stylish :evil:


FootbaG

Share this post


Link to post
Share on other sites

_StringReverse

But your function specifys how many characters to rotate :) Very stylish :D

<{POST_SNAPBACK}>

Thanks for the feedback.

P.S. what do you mean by _StringReverse because IMO it has nothing to do with _StringReverse. :evil:


HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

Thanks for the feedback.

P.S. what do you mean by _StringReverse because IMO it has nothing to do with _StringReverse.  :D

<{POST_SNAPBACK}>

You mean esreveRgnirtS_? :)

Cheers.. :evil:

Share this post


Link to post
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
Sign in to follow this  
Followers 0