简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM