Domanda

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 "
È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top