gpt4 book ai didi

java - 拆分字符串并使用 java 获取每个值

转载 作者:行者123 更新时间:2023-11-29 06:59:01 25 4
gpt4 key购买 nike

我有一个格式如下的字符串

Duplicate application\Your request has been rejected by the Credit Bureau server.\Entered value is lower than the minimum requirement to apply with this Income proof document. Please try using any other Income Support Document.\Validation error. Policy criteria not met.\Decisioning System unavailable at the moment\Decision Center error:\We regret not being able to take your application forward at this point. Thank you for applying.

现在,我尝试使用定界符“\”拆分字符串。我正在尝试获取所有字符串并将我从响应中收到的字符串与每个值的拆分结果进行比较。我没有得到确切的信息..这是我的代码..

//Note SCBCC_NEW is the string which I will have..

String[] scbCCNewArray = SCBCC_NEW.split("/");
for(String results : scbCCNewArray) {
LOG.info("Value :"+results)
}

这是正确的方法吗?

最佳答案

您需要对反斜杠进行转义,因为它是 java 中的一个特殊字符。

String str = "Duplicate application\\Your request has been rejected by the Credit Bureau server.\\Entere";
String[] scbCCNewArray = str.split("\\\\");
for (String results : scbCCNewArray) {
System.out.println("Value :" + results);
}
Output:
Value :Duplicate application
Value :Your request has been rejected by the Credit Bureau server.
Value :Entere

关于java - 拆分字符串并使用 java 获取每个值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29326354/

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