Click here to Skip to main content
15,911,531 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi friends,
I have a file with text and numbers in it.
I want to fetch all the contact numbers one by one from that file. (Eg: 91-474-2299, 9999, 2500013) etc...
Is there any way to get it friends,,,
file might be large or medium... or even it can be html files...
Posted

Your example suggests (I may be wrong) contacts are 'comma separated' hence you could read the file line-by-line and (for each line) obtain the contacts using the comma as separator in the String.Split method.
 
Share this answer
 
v2
Comments
Yesudasan Moses 22-Aug-13 4:41am    
No,,,, I meant Output will be like this....
Yesudasan Moses 22-Aug-13 4:43am    
Text maybe like this...
<body>The Number of Thomson will be 1100<br /> and the number of James is 2000</body>
Lke this.... I dont want names, only numbers,,,
CPallini 22-Aug-13 4:46am    
Is it an XML file? Why don't you post an exact portion of the input file in your original post?
Yesudasan Moses 22-Aug-13 4:48am    
It can be HTML file or text file,,, i dont know,,, :(
what want is to get a number which exceed 4 digits ,,,,
CPallini 22-Aug-13 4:54am    
Oh, that's fine. You might use regular expressions. You may even 'handcraft' the line parsing: find a the first digit and then scan successive characters until a non-digit appears.
You can use RegEx class[^] with phone number pattern[^]. But remember, there exist different phone numbers for different countries[^]. For further information, please, see national conventions[^].

So, only one (maybe two) number from this set of numbers: 91-474-2299, 9999, 2500013 could be a phone number. That's why i'm thinking that Split function - in this case - is not enough.
 
Share this answer
 
v2
Comments
CPallini 22-Aug-13 7:04am    
My 5.
Maciej Los 22-Aug-13 7:09am    
Tahnk you, Carlo.

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