How to convert string to charSequence ?
i have code like
String tdTargettext = tdTerms[j][1].getText();
if(targetSegment.contains(tdTargettext.subSequence(0,tdTargettext.length())))
{
}
I want to use string into contains method which accepts only charsequence
[code]
String tdTargettext = tdTerms[j][1].getText();
CharSequence ch=tdTargettext;
if(targetSegment.contains(ch.subSequence(0,ch.length())))
{
}
[/code ]
For Above code it is giving:::java.lang.NoSuchMethodError: java.lang.String.contains(Ljava/lang/CharSequence;)Zthis error
Suggest Solution
Thanks
OK, now we're getting somewhere. First off:
1) what is targetSegment? You show a call to its contains method but you don't define it anywhere in your code sample. This is the source of your error, so don't you think it would be important to show it?
2) Based on the error message snippit, I'm guessing that targetSegment is a String. If so, have you looked up the String api (or the charSequence api for that matter)? What does it tell you about the "contains" method?
Answer these questions and maybe I can help you further.
Also perhaps you could try a variation on the String method regionMatches.
Message was edited by:
petes1234