digitalmars.D - Bug in split?
- mcl (10/10) Sep 05 2004 std.string.split and std.string.splitlines don't seem to be stopping at ...
- Andy Friesen (5/17) Sep 05 2004 This is probably because you're using printf instead of writef. :)
- mcl (3/7) Sep 05 2004 D'oh! I completely forgot about writef. From now on I'm going to switc...
- Ivan Senji (6/16) Sep 05 2004 It works for me. Maybe there is something else wrong in your
std.string.split and std.string.splitlines don't seem to be stopping at the delimiters for substrings. Here's an example: char[] str1 = "A B C D"; char[][] str2 = split(str1); Will result with str2 equal to: "A B C D" "B C D" "C D" "D"
Sep 05 2004
mcl wrote:std.string.split and std.string.splitlines don't seem to be stopping at the delimiters for substrings. Here's an example: char[] str1 = "A B C D"; char[][] str2 = split(str1); Will result with str2 equal to: "A B C D" "B C D" "C D" "D"This is probably because you're using printf instead of writef. :) str2's elements point inside str1, but never modifies them, so there is only ever one terminating null. -- andy
Sep 05 2004
In article <chh0ae$11da$1 digitaldaemon.com>, Andy Friesen says...This is probably because you're using printf instead of writef. :) str2's elements point inside str1, but never modifies them, so there is only ever one terminating null. -- andyD'oh! I completely forgot about writef. From now on I'm going to switch over to streams from stdio. But first I need to get some sleep.
Sep 05 2004
It works for me. Maybe there is something else wrong in your code. Post the entire (but as small as possible) example that has this behaviour. "mcl" <mcl_member pathlink.com> wrote in message news:chgvft$116p$1 digitaldaemon.com...std.string.split and std.string.splitlines don't seem to be stopping atthedelimiters for substrings. Here's an example: char[] str1 = "A B C D"; char[][] str2 = split(str1); Will result with str2 equal to: "A B C D" "B C D" "C D" "D"
Sep 05 2004