Click here to Skip to main content
15,889,034 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have following SMS Information string,i want to split Mobile no and Date & time from string.


@ 13,"REC READ","9021523344",,"2012/11/26 13:07:08+22"
Great News!!Paiye 115% TT!!Rs 1000 ke recharge par Rs 1150 ka talktime,toh aaj hi apne nazdiki retailer se Rs 1000 ka recharge karwaye.Dial *125# to check baln.
Posted
Comments
__TR__ 27-Nov-12 1:15am    
Try using string.split[^] method

It depends on how do you define what a word is. For example, this will split the words composed of the characters from the ASCII subset of the letters:
C#
string[] words = Regex.Split(str, "[^a-zA-Z]+");


The idea here is to match all sub-strings of characters which cannot be a part of word and split by them.

Please see: http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.aspx[^].

—SA
 
Share this answer
 
v2
Comments
bbirajdar 27-Nov-12 1:31am    
Exactly.. He needs to use regex..
Sergey Alexandrovich Kryukov 27-Nov-12 1:35am    
Thank you.
--SA
bbirajdar 27-Nov-12 1:54am    
Seems somebody is jealous of you... He voted you 1 :) ..
Sergey Alexandrovich Kryukov 27-Nov-12 2:03am    
Ha-ha. It happens all the time. There are several distinct patterns, so those people could be classified. One or two people run up suddenly and vote 1 for some 5-10 answers in a row so quickly that I cannot believe they read it. Someone with high reputation often votes 1 on any strong opinion. I see no correlation with the kind of opinion, but this is explainable: this is the "who are you to tell us how to live?" kind of thinking. I call it "hatred voting"... I happen to consider my strongly opinionated answers the best and don't want to give them up though...
--SA
bbirajdar 27-Nov-12 2:21am    
SA.. I like your attitude and your ideology of living life on your own terms.. I agree that a person with experience and expertise like you does not need to pay much heed to these small things..
 
Share this answer
 
use inbuild function of C# for same-> String.Split on the basis of "," (comma).


Thanks,
Ambesha
 
Share this answer
 
Hi,
Why can't you split the message string using split

string str1 = "Hi,hello how r u,ru fine.";
string[] str = str1.Split(',');
for (int i=0; i < str.Length ; i++)
{
MessageBox.Show(str[i].ToString());
}

based on the index get ur mobile number and date
 
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