Jump to content
Sign in to follow this  

Input first character of string

Recommended Posts


I want to allow a character, like !, only is in the first position of the input like:


The problems is how...If i use StringLeft($Input, 1 ) work only if the string is empty because if i have:


And i move the caret at the first position, like.


And i try to write not work bacuse the StringLeft($Input, 1) = c

I have think something like the char at the left of the caret but i don't know if possible. Any suggestion are welcome. Thank you

EDIT: Or maybe some RegExp for check if ! is the first character, if not replace it with ""

Edited by MyEarth

Share this post

Link to post
Share on other sites

#include "RestrictControlRegExp.au3"

Opt("GUIOnEventMode", 1)

_RegEx_RestrictControl_setup (20) ; prepare for up to 20 Controls to restrict

GUISetOnEvent(-3, "_quit")
$inp = GUICtrlCreateInput("", 10, 200, 100, 20)
_RegEx_RestrictControl_add ($inp, "\A[!]", "!abc")


While 1

Func _quit()
EndFunc   ;==>_quit

'?do=embed' frameborder='0' data-embedContent>>

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

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  

  • Create New...