Home > Java > JavaBase > body text

How to determine whether a character is a number in java

王林
Release: 2019-11-13 13:48:58
Original
6037 people have browsed it

How to determine whether a character is a number in java

1. Use regular expressions to check whether the character is a number. If it is, it will return true, if not, it will be false

How to determine whether a character is a number in java

2. Use The function "Character.isDigit" that comes with java determines whether a character is a number. The specific code is as follows:

How to determine whether a character is a number in java

#3. You can use the indexof index to determine whether a character is a number. See the code. Picture below:

How to determine whether a character is a number in java

Recommended tutorial: Java tutorial

The above is the detailed content of How to determine whether a character is a number in java. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!