Jump to content

number of characters in a string?


Eli
 Share

Recommended Posts

How do I count the number of characters in a string?

what I want is

if 'string character count' > 10 then

msgbox(0, "", "NO")

or........

can I limit an input to a certain amount of characters? and limit the entry to numbers only?

Link to comment
Share on other sites

  • Moderators

Damn Sean.. You are all over the place today... This is a good day to quit smoking for me (no need to try and help anyone!!) :P

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

An example

$len = StringLen("How long am I?")
if $len > 10 Then
MsgBox(0, "", "NO")
EndIf


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

IsNumber()

maybe this ... $ES_NUMBER

#include <GuiConstants.au3>

; GUI
GUICreate("MY GUI")
$Input_T = GUICtrlCreateInput("30", 50, 28, 40, 20, $ES_NUMBER)
GUISetState()

While 1
    $Msg = GUIGetMsg()
    
    If $Msg = $GUI_EVENT_CLOSE Then Exit
    
WEnd

8)

NEWHeader1.png

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...