Irfan
Irfan

Reputation: 303

Testing for Characters over a String

aSimple question i got, what's the easiest way to check if my String includes any alphabetic characters?? rather than streaming over it. I tried "isAlphaNumeric" gives me an error.

 |a|
 a:= '1625.46brd'.
 "check if a includes alphabets "

Upvotes: 2

Views: 515

Answers (1)

Uko
Uko

Reputation: 13386

a anySatisfy: [ :char | char isLetter ]

Here you iterate a as a Collection and check if any character is a letter. If you want it not only letters (I understand alphabet as letters) you can send isAlphaNumeric message.

Upvotes: 4

Related Questions