gpt4 book ai didi

android - 如何从 TextView 中删除  

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:04:47 30 4
gpt4 key购买 nike

我需要在 TextView 中替换 &nbps。我可以简单地使用 String.replace(),但可能有更好的解决方案?

最佳答案

尝试使用 Pattern.compile:

Pattern p = Pattern.compile("&nbps");
String tempstr = "I love &nbps &nbps.";

Matcher matcher = p.matcher(tempstr);
String tmp = matcher.replaceAll("Android");

你可以看到这篇关于 String.replace 和 matcher.replace 性能的帖子

String replaceAll() vs. Matcher replaceAll() (Performance differences)

关于android - 如何从 TextView 中删除 &nbsp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13836421/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com