将文本从我的数据库导入到 Android 时仍然存在问题
我在格式化图像上显示的符号时遇到问题。我从这个网站得到了帮助,我使用了 Html.fromHtml()
并希望它能使用格式,它所做的唯一的事情就是删除格式符号,但不删除任何其他内容,例如换行符等。
如果我找不到使用格式的方法,我想知道是否可以在每次显示符号时添加“\n”。问题是如果我尝试使用类似的方法 (Ps,这里使用“[]”而不是真正的符号,因为我不知道如何编写它。
int nr=theTextString.indexOf("[]")
and then replace the text with
theTextString=theTextString.substring(0,nr)+ "\n" + theTextString.substring(nr);
但问题是该符号没有表示为用于查找索引的字符,而不是以任何方式我真的很感谢您的帮助
。
I have had a problem with formattings symbols shown on the image. I got help from this site and I used Html.fromHtml()
and hope that it would use the formatting, the only thing it did was to remove the formatting symbol but not anything else like newline or so.
If I cant find a way to use the formatting I wonder if it is possible to add a "\n" everytime the symbol is shown. The thing is if I try to use a method like
(Ps the "[]" is used here instead of the real symbol cause I cant find out how to write it.
int nr=theTextString.indexOf("[]")
and then replace the text with
theTextString=theTextString.substring(0,nr)+ "\n" + theTextString.substring(nr);
but the problem is that the symbol is not represented as a character to look for the index at, not in any way I know of. Would really be thankful for help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果
[]
废话字符仅显示在最后一个字符上,请执行以下操作顺便说一句:
[]
<-- 不是同一个字符(事实上,有两个字符)是别的东西。解决方案:对字符串进行编码
If
[]
crap character is only shown on the last chacter do thisBtw:
[]
<-- is not the same character (Infact, there are two characters) it is something else.Solution: To encode the string