String
object cannot store whether the text is bold
, italic
. It has only a character array.
Bold
or Italic
means a visual effect.
You can try something like following to detect what are the text you should add effects.
String str = "Google Plus style #ListViews are all
the rage these days on #Android because of the slick @animations.";
String[] arr = str.split(" ");
for (String i : arr) {
if (i.startsWith("#")) {
// do something for #
} else if(i.startsWith("@")){
// do something for @
} else {
// other text
}
}
1
solved How to separate special string in android