Separating a Ton of Phone Numbers with Commas
Translated from Chinese by Claude. Read the original
Tonight I needed to text more than 50 people, so I thought of Wandoujia. I copied the numbers from Excel into Wandoujia to send them all at once with its group SMS feature. As it turned out, things weren’t as simple as I’d thought.
I copied from Excel into Notepad, and it pasted the Excel way, as a column, not as a single line. So I copied the column of numbers into Wandoujia, and the result left me shattered…
You can see it says it will be sent to one contact. What now? Was I supposed to add English commas one by one to separate them? I told myself I couldn’t do something that primitive. After all, I’m a code monkey!
Scouting the Way with C, Done in No Time
I know C and Java, but in the end I chose C to write this little program. First you create a character array to hold the huge pile of numbers. Then the whole program works by replacing newline characters with English commas.
1 |
|
Using C’s file functions, the numbers get written out to Output.txt. Aha! That makes things so much easier.