字符串解析和拆分 [英] String parsing and split

查看:108
本文介绍了字符串解析和拆分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我的字符串为'3V 1 TP& WB; -OV 29.95''&'和'+'特殊字符我正在分裂太空弦。但它也用'&'和'+'字符分割字符串。



示例:它还用'&'字符分割TP& WB。

3V,1,TP,WB,; - OV,29.95



那么,为什么它会被'&'和'+'字符拆分也?



谢谢



我的尝试:



(1)我尝试用其他字符替换这些特殊字符,并在将数据存储到数据库时再次将其替换为原始字符。

(2)进行检查,如果它被&分开和+,是的它分为&和+。

解决方案

橙子。



请记住,问题的质量决定了质量回答。



=============================



在投票无效的1票之前,请记住 我试图说明一点 b>

该问题提供无代码评估,因此我们无法有效地帮助他。在他召集力量将问题编辑成我们可以解决的问题之前,这里是他的问题的原始文本:



我有字符串'3V 1 TP& WB; -OV 29.95''&'和'+'特殊字符,我正在按空格分割字符串。但它也用'&'分割字符串和'+'字符。 

示例:它还将'&'拆分为TP& WB字符。
3V,1,TP,WB,; - OV,29.95

那么,为什么它被'&'拆分还有'+'字符?


Hello,

I have string with '3V 1 TP&WB;-OV 29.95' '&' and '+' special characters and I am splitting string by Space. but it also splits string by '&' and '+' characters.

example: it also splits TP&WB by '&' character.
3V, 1, TP, WB,;-OV,29.95

So, why it is splitting by '&' and '+' characters also?

Thanks

What I have tried:

(1) I have tried with replacing those special characters with other characters and again at a time of storing data to DB, I am again replacing by original characters.
(2) place check, if it splits by & and +, and yes it splits by & and +.

解决方案

Oranges.

Remember, the quality of the question dictates the quality of the answer.

=============================

Before the down-voting nazis chime in with pointless 1-votes, keep in mind that I'm trying to make a point.
The question provides NO CODE to evaluate, so we can't POSSIBLY help him effectively. Before he summons the strength to edit the question into something we can address, here's the original text of his question:

I have string with '3V 1 TP&WB;-OV 29.95' '&' and '+' special characters and I am splitting string by Space. but it also splits string by '&' and '+' characters.

example: it also splits TP&WB by '&' character.
3V, 1, TP, WB,;-OV,29.95

So, why it is splitting by '&' and '+' characters also? 


这篇关于字符串解析和拆分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆