开发者

Android multi-line textview - character count of a particular line?

I'm trying to get the character count of a particular line of a multi-line textview. Based on other posts, I've gotten the Layout of the textview in question. I see several methods that pass in an (int line), but none that return a character count o开发者_高级运维f a particular line? Am I just missing it? Any help would be appreciated.


This will split the text in the textview by lines.

String text;
String[] lines = text.split("\\r?\\n");
int characterCount = lines[0].length();


if your just trying to get the count of a string, have you tried String.length(myString) to return a count of how many characters are in the string?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜