How does android determine if the value entered in EditText is a number or a Chinese character?

Updated on culture 2024-02-09
9 answers
  1. Anonymous users2024-02-05

    XML, but you can do it in **.

    To give you a way to judge the kanji, private boolean ischinese(char c) {.}

    ub = ;

    if (ub ==

    ub ==ub ==

    ub ==ub ==

    ub == {

    return true;

    return false;

    The number is judged according to the range of Unicode!

  2. Anonymous users2024-02-04

    You can judge the characters directly with the ASCII code.

  3. Anonymous users2024-02-03

    Get the value of the edittext input and match it with a regular expression!

  4. Anonymous users2024-02-02

    First: In order to get all the data in EditText before getting the input number, check the API, there are the following methods.

    Returns the parameter type, method name, and the definition of the method.

    editable gettext() return the text the textview is displaying.

    This method can return the text that the textview is displaying, and the type of the returned value is editable, which seems unfamiliar.

    Let's take a look at the editable API, which is as follows:

    Then there is a method in the charsequence.

    abstract string tostring() returns a string with the same characters in the same order as in this sequence.

    Then you can get a string object, and then the operation of string is not much more convenient, by taking out each character to determine whether it is a number, ** as follows:

    string str=et_;

    if(str != null &&"".equals(str))}

  5. Anonymous users2024-02-01

    In Android, edittext can be set to android:digits, which means that only specified content can be entered.

    It can also be handled in the following ways:

    Add android:digith= to the xml"0123456789"Only 0-9 can be entered

    in xml android:maxlength="10"The maximum number of characters is 10 characters.

    Judge with regular expressions"^[0-9a-za-z]$"Can.

  6. Anonymous users2024-01-31

    Get the editview string, if it doesn't work, substring, and then assign it back.

  7. Anonymous users2024-01-30

    XML, but you can do it in **.

    To give you a way to judge the kanji, private boolean ischinese(char c) {.}

    return false;

    The number is judged according to the range of Unicode!

  8. Anonymous users2024-01-29

    if(current string of numbers)!=、==、>、=、<、= ;

  9. Anonymous users2024-01-28

    ;Convert strings to numbers.

    Get the string inside.

Related questions
11 answers2024-02-09

There is no such relationship between a man and a woman, a couple are married from good friends, this kind of I can be sure that the man must like you, otherwise he spends so much effort to please you. I think he has a crush on you. If you don't believe him, you can ask him directly.

9 answers2024-02-09

I don't hate you, I don't dislike you, I don't pay attention to and care about you, it's just an ordinary friend, don't get entangled in this Menglong relationship, the way to make people like you is to enhance your own image.

9 answers2024-02-09

Clause. 1. Brightness, brightness is an aspect of the car wax, but the brightness has foggy greasy brightness and natural brightness, generally good car wax is natural brightness and clarity is obvious, but no matter how good the car wax, for dark car paint plain car paint (such as: Japanese, domestic, general series dark car paint) brightness improvement is very obvious, for metal paint, light-colored paint, especially the improvement of the brightness of the new car is not easy to distinguish with the naked eye, that is, it is not obvious, this is because of the characteristics of the paint itself and the principle of light! >>>More

11 answers2024-02-09

1. For reactive power compensation, there are three kinds of compensation: centralized compensation, decentralized compensation and follower compensation; >>>More

17 answers2024-02-09

In tennis, each serve has 2 chances, and a service error means that the ball is not served in the service area, and the serve goes to the net or wipes the net, (wiping the net at the time of 1 serve is considered a mistake, and when serving at 2, it is not counted as a double fault.) Generally, there is a division line to watch. If you double fault the serve, it means that you directly judge the 1-ball server to lose, and the opponent scores!