Detailed explanation of Android automatic tool class textutils

Today, let's talk about how to use Android's automatic tool class textutils.

Simple enumeration of partial usage:

The results are as follows:

This focuses on how to use textutils. Isempty().

Whether it is an empty character static Boolean isempty (charsequence STR) is often used when we judge that the string is empty.

Note here that spaces also return false. In fact, just look at the source code

If a space is passed in, the length of the string will not be 0, so false is returned. In order to determine whether the input string of EditText is an empty string, you can first pass the string trim() and then isempty to successfully determine.

The use of Android textutils is over.

It's that simple.

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>