Click here to Skip to main content
15,886,801 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,

Please help me for the spliting the string ,
I have string i.e "vilas`^jashav`^Madhav`^chavan";
and I want to split it with `^ delemeter

string test = "vilas`^jashav`^Madhav`^chavan";
string[] a_test = Regex.Split(test, "`^");
But i have not proper array with splitting string.
anybody help me for split with delemeter `^

Thanks
vilas
Posted

Try this
C#
string a ="vilas`^jashav`^Madhav`^chavan";
string[] b = a.Split(new string[] {"`^"}, StringSplitOptions.RemoveEmptyEntries);

--SJ
 
Share this answer
 
Comments
Sperneder Patrick 6-Dec-12 8:18am    
whats the difference to my solution ? :-) ( instead of using string as delimiter...)
codeninja-C# 6-Dec-12 8:28am    
@Sperneder,Difference is --> new char[] { '`', '^' }
Sperneder Patrick 7-Dec-12 1:44am    
ok, now i got it... couldn't see the apostrophe before the other char... :-)
codeninja-C# 7-Dec-12 1:47am    
:-)
Hello vilas,

For this purpose i normally use String.Split Method.

C#
string names = "vilas^jashav^Madhav^chavan";
string[] parts = names.Split(new char[] { '^'}, StringSplitOptions.RemoveEmptEntries);


regards Patrick
 
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