Android developer _ string processing class-TextUtils class

Source: Internet
Author: User
Tags html encode

Android provides a simple and practical TextUtils class for string processing. If you do not need to think about regular expressions when processing relatively simple content, try this in android. text. the TextUtils class has the following functions: whether it is a NULL Character static boolean isEmpty (CharSequence str) split String public static String [] split (String text, String expression ), android Development Network prompts you to take a closer look at the example String below. split () returns [''] when the string to be split is empty. this returns []. this does not remove any empty strings from the result. for example split ("a,") returns {"",""}. use the regular public static String [] split (String text, Pattern pattern) to split the String to determine whether the text TextUtils at the current position is valid. getCapsMode (CharSequence cs, int off, int reqModes) uses HTML to Encode this String static String TextUtils.html Encode (String s)

<span style="color:#ff0000;">if (!TextUtils.isEmpty(spUtil.getUserId())) {</span>                  Intent intent = new Intent(WelcomeActivity.this,                          MainActivity.class);                  startActivity(intent);              } else {                  startActivity(new Intent(WelcomeActivity.this,  

 

FirstSetActivity. class ));}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.