CharAt Function
This function returns the character at a given position(index) in a string.
While it's a fairly simple thing to do, and we have the StringInStr and StringMid native functions which can be setup to get the same result, sometimes what we need is a simple approach to this. I hope any of you can find it useful.
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
;Given a String and an Index, returns the character at that position.
;The index count starts in zero
;Test variables
Dim $test = "test String"
Dim $index = 10
;Function
Func CharAt($String,$Index)
Dim $char ;==> $char will contain the desired character
$length=StringLen($String)
If $length <= $Index Then ;==> This IF will check wether the index is valid for the given String or not
Return "ERROR:Index is out of bounds"
Else
$count=$length-($Index+1)
$char=StringTrimLeft(StringTrimRight($String,$count),$Index)
EndIf
Return $char
EndFunc
;Test run
$c = CharAt($test,$index)
MsgBox(0, "String length is:", $c)