www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - std.string.split()

reply Gareth Baker <g.j.baker dl.ac.uk> writes:
Hi,

I've just discovered D and have loaded the GCC fronted on my Mac. I'm 
trying some simple stuff and have come across a problem. I'm using 
string.split("a line of text with % in it, some more text", ","). Split 
seems to choke on lines with a "%" in. Is this normal behaviour? Would 
std.regexp.split be a better bet?

Thanks
Gareth Baker
Oct 22 2005
parent Oskar Linde <olREM OVEnada.kth.se> writes:
Gareth Baker wrote:

 Hi,
 
 I've just discovered D and have loaded the GCC fronted on my Mac. I'm
 trying some simple stuff and have come across a problem. I'm using
 string.split("a line of text with % in it, some more text", ","). Split
 seems to choke on lines with a "%" in. Is this normal behaviour? Would
 std.regexp.split be a better bet?
 
 Thanks
 Gareth Baker
Hi, Split should not choke on the %... But your output method may. Try printing the substrings with writef("%s",str); /Oskar
Oct 23 2005