简体   繁体   English

测试字符串上的字符

[英]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. 我尝试过“ isAlphaNumeric”给我一个错误。

 |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. 在这里,您a a迭代为Collection,并检查是否有任何字符是字母。 If you want it not only letters (I understand alphabet as letters) you can send isAlphaNumeric message. 如果您不仅需要字母(我将字母理解为字母),还可以发送isAlphaNumeric消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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