Home  >  Article  >  Java  >  How to determine whether a character is a number in java

How to determine whether a character is a number in java

王林
王林Original
2019-11-13 13:48:585990browse

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!

Statement:
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
Previous article:What is a thread in javaNext article:What is a thread in java