无法分割 Http 响应
我正在尝试拆分从 http 发布中获得的响应。响应是一个字节数组。
我试图将其拆分为,
String venuesArray[] = text.toString().split("~~~");
for (String venueDetails:venuesArray) {
String arr2[] = venueDetails.split("^^^");
}
在这里我可以毫无问题地拆分场地数组,但同样的事情不会发生在场地细节上。它没有被分裂。
对此有什么答案吗?
I am trying to split the response that I got from http posting. The response is a byte array.
I am trying to split this as,
String venuesArray[] = text.toString().split("~~~");
for (String venueDetails:venuesArray) {
String arr2[] = venueDetails.split("^^^");
}
Here I am able to split the venuesArray without any problem, but same thing is not happening with venueDetails. It is not getting splitted.
Any answer for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
^ 字符是特殊字符,需要转义。
在Java中,反斜杠也很特殊,所以需要额外的转义。
The ^ character is a special character and needs to be escaped.
In Java, the backslash is also special, so you need an extra escape.
应该这样做。
should do it.
如果venuesArray 正在分裂,那么VenuesDetails 也应该分裂。请检查 VenuesArray 中是否有场地。如果是这样,
请尝试使用正则表达式:
希望有帮助。
If venuesArray is splitting then, VenuesDetails should also split. Please check once VenuesArray has venues in it. If so,
Try using Regex :
Hope it helps.