-7

My friend sent me a AutoIt riddle and a key to decrypt. I am a beginner in AutoIt [AU3] and I am stuck on "split".

;~ AutoIt Code StringReverse("46-ESAB") Func StringReverse( $input )
Local $output
Local $split = StringSplit( $input , "")
For $i = $split[0] to 1 Step -1
    $output &= $split[$i]
Next
Return $output EndFunc
halfer
  • 19,824
  • 17
  • 99
  • 186
Sam
  • 1
  • 1

2 Answers2

1

Your code should look like this:

;~ AutoIt Code StringReverse("46-ESAB") 

Func StringReverse( $input )

Local $output
Local $split = StringSplit( $input , "")
For $i = $split[0] to 1 Step -1
    $output &= $split[$i]
Next

Return $output 

EndFunc

You can call it like this:

MsgBox(0, "My output:", StringReverse("!sdrawkcaB"))

Hope this helps? I can really, REALLY recommend the AutoIT Help file - full of good information and examples.

Pete
  • 11
  • 1
1

There is a buildin function called StringReverse which does exactly the same as your function does.

If I get your question right, $splitis an array, containing the length of the array in field $split[0]and after that each char of the string in the following fields of the array.

But as Pete says, the AutoIt help is awesome! You can try this page for an overview: https://www.autoitscript.com/autoit3/docs/

Or this link for function descriptions:
https://www.autoitscript.com/autoit3/docs/functions.html

Here is the side for the StringReverse function: https://www.autoitscript.com/autoit3/docs/functions/StringReverse.htm

Krossi
  • 81
  • 6