Jump to content

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


Rorax
 Share

Recommended Posts

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
Link to comment
Share on other sites

  • Moderators

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')

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

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