Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
source code for how to split uploaded text file base don any special character?
Posted
Updated 29-Jan-14 0:17am
v3
Comments
BillWoodruff 29-Jan-14 7:06am    
"any special character" I think you mean any character you choose, but if you mean something else, please clarify.

Try this.

C#
string input = "q~c!d#e5;3'4]%f^g&h(";
        char[] specialChars = input.Where(k => (!(char.IsLetter(k) || char.IsDigit(k)))).ToArray();
        string[] split = input.Split(specialChars,  StringSplitOptions.RemoveEmptyEntries);
 
Share this answer
 
v2
Comments
BillWoodruff 29-Jan-14 8:05am    
Even though we are "dancing in the dark" with the OP, this definitely deserves a 5 !
Karthik_Mahalingam 29-Jan-14 8:06am    
ha ha :)
Thanks Bill:)
Hi Praveen,

Stored the uploaded file text in string then split it using string.splip("/") function.

e.g.

C#
string text ="prasad/raghu/praveen";
           string[] splittedValues = text.Split('/');


splittedValues stores as follows

C#
splittedValues[0] = "prasad";
splittedValues[1] = "raghu";
splittedValues[2] = "praveen";
 
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