D - split and splitlines
- Charles Sanders (32/32) Jul 20 2003 Im a bit confused about the behavior of split and splitlines (tried both...
- Vathix (5/37) Jul 20 2003 It separates each line in the file. Remember that the slices aren't
- Charles Sanders (13/69) Jul 21 2003 Thanks V, another quick question;
- Vathix (5/78) Jul 21 2003 elements = null;
Im a bit confused about the behavior of split and splitlines (tried both). I have this code void main() { //Validator val = new Validator(); byte [] wholeFile = file.read("C:\\temp"); char [] [] lines = file.splitlines((char[])wholeFile); for (int i = 0;i < lines.length;i++) { puts((char[])lines[i]); } //val.Validate(lines,seperator); } And in the file temp, I have this, is, a , comma, seperated list, for , you, to seperate more, stuff, here, for you, you, silly, oaf What im getting is for lines[0] this, is, a , comma, seperated list, for , you, to seperate more, stuff, here, for you, you, silly, oaf lines[1] list, for , you, to seperate more, stuff, here, for you, you, silly, oaf lines[2] more, stuff, here, for you, you, silly, oaf lines[3] you, silly, oaf Is this the intended behavior ? Charles
Jul 20 2003
It separates each line in the file. Remember that the slices aren't null-terminated. Use: puts(toStringz((char[])lines[i])); "Charles Sanders" <sanders-consulting comcast.net> wrote in message news:bffl63$nl3$1 digitaldaemon.com...Im a bit confused about the behavior of split and splitlines (tried both). I have this code void main() { file://Validator val = new Validator(); byte [] wholeFile = file.read("C:\\temp"); char [] [] lines = file.splitlines((char[])wholeFile); for (int i = 0;i < lines.length;i++) { puts((char[])lines[i]); } file://val.Validate(lines,seperator); } And in the file temp, I have this, is, a , comma, seperated list, for , you, to seperate more, stuff, here, for you, you, silly, oaf What im getting is for lines[0] this, is, a , comma, seperated list, for , you, to seperate more, stuff, here, for you, you, silly, oaf lines[1] list, for , you, to seperate more, stuff, here, for you, you, silly, oaf lines[2] more, stuff, here, for you, you, silly, oaf lines[3] you, silly, oaf Is this the intended behavior ? Charles
Jul 20 2003
Thanks V, another quick question; I have a loop that looks something like char [] [] elements; loop { char [] line = read (...); elements ~= line; } how would i reset elements, so that it contained no elements ? Also, what happent to the IRC server ?? Charles "Vathix" <vathix dprogramming.com> wrote in message news:bffv35$11dq$1 digitaldaemon.com...It separates each line in the file. Remember that the slices aren't null-terminated. Use: puts(toStringz((char[])lines[i])); "Charles Sanders" <sanders-consulting comcast.net> wrote in message news:bffl63$nl3$1 digitaldaemon.com...both).Im a bit confused about the behavior of split and splitlines (triedI have this code void main() { file://Validator val = new Validator(); byte [] wholeFile = file.read("C:\\temp"); char [] [] lines = file.splitlines((char[])wholeFile); for (int i = 0;i < lines.length;i++) { puts((char[])lines[i]); } file://val.Validate(lines,seperator); } And in the file temp, I have this, is, a , comma, seperated list, for , you, to seperate more, stuff, here, for you, you, silly, oaf What im getting is for lines[0] this, is, a , comma, seperated list, for , you, to seperate more, stuff, here, for you, you, silly, oaf lines[1] list, for , you, to seperate more, stuff, here, for you, you, silly, oaf lines[2] more, stuff, here, for you, you, silly, oaf lines[3] you, silly, oaf Is this the intended behavior ? Charles
Jul 21 2003
elements = null; The IRC server is back up now, sorry about that! There was a problem with the ISP, it was beyond my control. "Charles Sanders" <sanders-consulting comcast.net> wrote in message news:bfi3e5$92h$1 digitaldaemon.com...Thanks V, another quick question; I have a loop that looks something like char [] [] elements; loop { char [] line = read (...); elements ~= line; } how would i reset elements, so that it contained no elements ? Also, what happent to the IRC server ?? Charles "Vathix" <vathix dprogramming.com> wrote in message news:bffv35$11dq$1 digitaldaemon.com...It separates each line in the file. Remember that the slices aren't null-terminated. Use: puts(toStringz((char[])lines[i])); "Charles Sanders" <sanders-consulting comcast.net> wrote in message news:bffl63$nl3$1 digitaldaemon.com...both).Im a bit confused about the behavior of split and splitlines (triedI have this code void main() { file://Validator val = new Validator(); byte [] wholeFile = file.read("C:\\temp"); char [] [] lines = file.splitlines((char[])wholeFile); for (int i = 0;i < lines.length;i++) { puts((char[])lines[i]); } file://val.Validate(lines,seperator); } And in the file temp, I have this, is, a , comma, seperated list, for , you, to seperate more, stuff, here, for you, you, silly, oaf What im getting is for lines[0] this, is, a , comma, seperated list, for , you, to seperate more, stuff, here, for you, you, silly, oaf lines[1] list, for , you, to seperate more, stuff, here, for you, you, silly, oaf lines[2] more, stuff, here, for you, you, silly, oaf lines[3] you, silly, oaf Is this the intended behavior ? Charles
Jul 21 2003