开发中我们有可能会遇到这种情况,就是将字符串中的某个字符去掉
PHP代码
@Test
public void test() {
String d = trimPunctuation2("你,好oewefo,21.2!;:、1?dsf");
System.out.println(d);
}
// 将字符串中的标点符号过滤掉
public static String trimPunctuation2(String str) {
String punct[] = { ",", ".", "!", "?", ";", ":", ",", "。", "!", "?",
";", ":", "、" };
List<string> punctList = Arrays.asList(punct); // 将String数组转List集合
StringBuilder result = new StringBuilder();
for (int i = 0; i <p> </p><div class="aritcle_card flexRow artxards">
<div class="artcardd flexRow">
<a class="aritcle_card_img" rel="nofollow" href="/xiazai/skill13222" title="Build MCP servers and clients for PHP applications with the official PHP SDK"><img
src="https://img.php.cn/upload/skill/001/246/273/6adaf20e352aa140.jpg" alt="Build MCP servers and clients for PHP applications with the official PHP SDK" onerror="this.onerror='';this.src='/static/lhimages/moren/morentu.png'" ></a>
<div class="aritcle_card_info flexColumn">
<a rel="nofollow" href="/xiazai/skill13222" title="Build MCP servers and clients for PHP applications with the official PHP SDK" class="overflowclass">Build MCP servers and clients for PHP applications with the official PHP SDK</a>
<p class="overflowclass">使用官方Model Context Protocol PHP SDK将PHP应用程序功能暴露为MCP工具、资源和提示,用于代理工作流。</p>
</div>
<a rel="nofollow" href="/xiazai/skill13222" title="Build MCP servers and clients for PHP applications with the official PHP SDK" class="aritcle_card_btn flexRow flexcenter"><b></b><span>下载</span>
</a>
</div>
</div>
<p><br></p></string>










