Sign in to follow this  
Followers 0
MyEarth

Input first character of string

3 posts in this topic

#1 ·  Posted (edited)

Hello,

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

!abc

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

abc

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

|abc

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

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

GUISetState()

While 1
    Sleep(10)
WEnd


Func _quit()
    Exit
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

Thanks

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