[英]how to remove first special character from string
I have values seperated by pipes in a database. 我在数据库中用管道将值分开。 But the issue is that I am appending |
但是问题是我要附加| at every entry.
在每个条目。
For Example: 例如:
|275634|374645|24354| | 275634 | 374645 | 24354 |
How can I remove the first pipe from the whole string not all the pipes. 如何从整个字符串而不是所有管道中删除第一个管道。
Once inserted I don't need to check for the next time when it updates. 插入后,下次更新时无需检查。
If I use substring(1) then it will remove the first character every time, 如果我使用substring(1),它将每次删除第一个字符,
Please suggest a fix? 请提出解决方案?
you can use substring(index)
method where ever you want to remove the perticular special character from the String: like 您可以在想要从字符串中删除垂直特殊字符的地方使用
substring(index)
方法:
String str2 = "|275634|374645|24354|";
str2 = str2.substring(1);
System.out.println(str2);
you can see the output as 275634|374645|24354|
您可以看到输出为
275634|374645|24354|
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.