Sign in to follow this  
Followers 0
Rorax

How to make a IF that checks if first letter is a letter or number

3 posts in this topic

#1 ·  Posted (edited)

I want to do a search (know that part) that checks if the first letter of the filename is a letter (a,b, c) etc. And if it is a (1,2,3%,¤,",!,/ basically anything that isnt a letter) non-letter it will skip to the next letter in the filename and do it again. But I dont really know if there is a easy way to do it without using tons of IF's.

Anyone have any good ideas?

Regards,

Rorax

Edited by Rorax

Share this post


Link to post
Share on other sites



I want to do a search (know that part) that checks if the first letter of the filename is a letter (a,b, c) etc. And if it is a (1,2,3%,¤,",!,/ basically anything that isnt a letter) non-letter it will skip to the next letter in the filename and do it again. But I dont really know if there is a easy way to do it without using tons of IF's.

Anyone have any good ideas?

Regards,

Rorax

$sString = '1adf.txt'
If StringIsAlpha(StringLeft($sString, 1)) Then MsgBox(64, 'Info', 'Chr is Not a Number')
If StringIsDigit(StringLeft($sString, 1)) Then MsgBox(64, 'Info', 'Chr is a Number')


$sString = 'adf.txt'
If StringIsAlpha(StringLeft($sString, 1)) Then MsgBox(64, 'Info', 'Chr is Not a Number')
If StringIsDigit(StringLeft($sString, 1)) Then MsgBox(64, 'Info', 'Chr is a Number')

[center]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.[/center]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks for the quick responce, I'll try it out right away. But if I get it correct it will check if its either a number or a letter. But what if its a character like %, ¤, (, ), [ or ]. Will it count as a letter or a number?

edit: I searched the help file with the stringis that you used, and found StringIsASCII which shows special characters. Thanks again for your help

Edited by Rorax

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