我有一个字符串,它可能会或可能不会以空格结尾,我无法确定是否是这种情况。检查字符串的末尾是否为空白字符
我之所以问这是因为我需要一个很好的方法来计算Android的宽度,因为我的字符串自动更正并进入下一行。
在Android中,它看起来像这样的事情:
The quick brown fox jumps over the lazy dog The quick brown fox jumps over the lazy d - my method substrings the data to fit on screen. |The quick brown fox jumps over the lazy | - this is how it would look like on android |dog---------------(empty space)----------|
我们改写我的问题,我想知道用什么方法,我需要用它来检查的最后一个字符在我的字符串是空白?
为什么它的价值,'字符串'总是包含“字符”,它可能是空白或不是。 (空白仍然是一个“人物”。)我编辑了你的帖子,试图消除这一点,我希望我能成功。 – 2012-01-11 18:20:25