I was wondering - "why do others use TextUtils in many purposes?" - but I am not clear about this. The Developer site says that it is a simple string splitter. I understand this but I don't know how to use this in a practical manner or what purposes I can use it? Can anyone provide me some practical example with a code snippet?
one of the uses of textUtils is for example lets say you have a string "apple,banana,orange,pinapple,mango" which doesnt fit inside a given width it can be converted to "Apple, banana, 2 more" . I like the idea, can you add some code for your answer. provide some code for implementation.
TextUtils.StringSplitter. An interface for splitting strings according to rules that are opaque to the user of this interface.
It is simply a set of utility functions to do operations on String objects. In fact, the whole class doesn't have any instance fields or methods. Everything is static. Consider it like a container to group functions with a text-based semantic. Many of them could have been methods of a String inherited class or CharSequence inherited class. For example you can do:
TextUtils.indexOf(string, char)
which is the same of doing
string.indexOf(char);
Many of them do things that you can already do with string public methods. Many others add additional functionalities. This class serves at a method level the same purpose that a package serves at a class level.
one of the uses of textUtils
is for example lets say you have a string "apple,banana,orange,pinapple,mango"
which doesnt fit inside a given width it can be converted to "Apple, banana, 2 more"
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With