支持楼上说的
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
- public class Test {
- public static void main( String [] args ) {
- String str = "sdhsajk23232hd4823748dsfkjdshfjk";
- Pattern p = Pattern.compile( "[a-zA-Z]" );
- Matcher matcher = p.matcher( str );
- while ( matcher.find() ) {
- System.out.print(matcher.group());
- }
- }
- }
复制代码 |