Click here to Skip to main content
15,894,907 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to select all phone numbers from Textfield seperated by comma and check out whether that number is 10 digit, What is the C# code for this
Posted
Updated 10-Dec-13 18:41pm
v2
Comments
Sergey Alexandrovich Kryukov 11-Dec-13 0:41am    
42.
—SA

1 solution

Hi
Try this code..


C#
string csv = txt.Text.Trim();
           string[] phoneNumbers = csv.Split(',');
           var validNumbers = phoneNumbers.Where(k => k.Length == 10).ToArray(); // this array has valid numbers
           var invalidNumbers = phoneNumbers.Where(k => k.Length != 10).ToArray(); // this array has invalid numbers 


 foreach (string _phoneNumber in validNumbers)
           {
               // sendSMS ( _phoneNumber );
           }
 
Share this answer
 
v2
Comments
SVT02 11-Dec-13 0:44am    
What is code for select all numbers for send sms
Karthik_Mahalingam 11-Dec-13 0:54am    
check my solution..
SVT02 11-Dec-13 1:04am    
Thanx..
Karthik_Mahalingam 11-Dec-13 1:17am    
if it helps u, pls mark it as answer. else post comments for more solution.

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