I want to know how can i detect some specified words in SpannableStringBuilder
.
My purpose is to change color of this words.
Say i have SpannableStringBuilder span
and the list included my Words like "Name" , "Family" , "Location" etc.
In this stage i want to check if my span
is including these words then change color of.
For example I want something like :
if(span.contain("Name")) // Change Color of the word "Name" every where in this span
if(span.contain("Family")) // Change Color of the word "Family" every where in this span
and so ...
Is there any method to check ? any code example will be appreciated.
There is no search method in
SpannableStringBuilder
but you can useindexOf()
after you convert it to aString
: