gpt4 book ai didi

java - 如何避免字符串重复

转载 作者:行者123 更新时间:2023-12-01 16:39:04 24 4
gpt4 key购买 nike

我有两个不同的字符串 String A="example";字符串 B="示例";如果连接两个字符串我得到examplexample。是否有可能避免重复具有相同名称的字符串..??

最佳答案

这个怎么样?

if(!a.equals(b)){// or if needed use contains() , equalIgnoreCase() depending on your need
//concat
}

关于java - 如何避免字符串重复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6026646/

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