Jump to content

UDF : _StringRotate()


FuryCell
 Share

Recommended Posts

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.
Link to comment
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.
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...