如何检查字符串以数字编号开头? [英] How to check a string starts with numeric number?

查看:242
本文介绍了如何检查字符串以数字编号开头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含字母数字字符的字符串。

I have a string which contains alphanumeric character.

我需要检查字符串是否以数字开头。

I need to check whether the string is started with number.

谢谢,

推荐答案

参见 isDigit(char ch)方法:

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Character.html

并使用 String.charAt()方法将其传递给String的第一个字符。

and pass it to the first character of the String using the String.charAt() method.

Character.isDigit(myString.charAt(0));

这篇关于如何检查字符串以数字编号开头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆