Skip to content Skip to sidebar Skip to footer

How To Split String In Android

Suppose i have a String, below String myText='I'm a android developer and i'm developing an android app'; so i want to split the above string with(' ' '), and want to put it on a

Solution 1:

I believe Pattern.quote() wrapps your RegExp so that it only works if the matching string in inside quotes.

In other words, I do not believe in this case it would work.

A simple String[] newDesc=Description1.split("'"); should work.

Solution 2:

Use this please

String[] newDesc=Description1.split("'");

Solution 3:

Use the below code to understand the split string you need:

Example : String myText = "I'm a android developer and i'm developing an android app";

String[] strParts = myText.split("'");

Then

StringstrFirstString= strParts[0]; // IStringstrSecondString= strParts[1]; // m a android developer and iStringstrThirdString= strParts[2]; // m developing an android 

Now display whichever String you want, in your textView.

Post a Comment for "How To Split String In Android"