Click here to Skip to main content
15,880,608 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
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 +.
Posted
Updated 29-May-18 3:27am
v3
Comments
OriginalGriff 28-May-18 2:09am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with. So show us the inputs, show us the code, and show use what you expected to get as well as what you did get!
Use the "Improve question" widget to edit your question and provide better information.
OriginalGriff 28-May-18 2:40am    
No, we need you to show us the code that does that.
Then look at what I said half an hour ago, and tell us that as well.

We can;t help you without the actual information!
kkakadiya 28-May-18 2:47am    
ok
GKP1992 28-May-18 3:16am    
If I simply do this,
var x = "3V 1 TP&WB;-OV 29.95";
var y = x.Split(' ');

I get "3V", "1", "TP&WB;-OV" and "29.95" in y. So, you're doing something wrong.
Patrice T 28-May-18 4:16am    
"So, why it is splitting by '&' and '+' characters also?"
Because your mystery code is wrong.

1 solution

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? 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900