View Full Version : split sentance in to array

03-18-2004, 10:11 AM

I have a string which is like the following

Dear {firstname},

Recently you.....

I read it in to an array and split up the paragraph based on " " (a space). The problem is, the above example has no space... so the array looks like

array[0] = "Dear";
array[1] = "{firstname},Recently";
array[2] = "you";

is there a way I could split the string based on commas, full stops or any other way? what's best?

03-18-2004, 04:27 PM
i don't have the exact code to use but i would first subsitute linebreaks for spaces then split into an array. Character escapes that represent new lines are '\r' '\n'. but i'm not sure they are applicable in this situation.

03-18-2004, 10:03 PM
try something like this: