digitalmars.D - Appending Arrays
- Trevor Parscal <trevorparscal hotmail.com> May 31 2005
- "John C" <johnch_atms hotmail.com> May 31 2005
- "Walter" <newshound digitalmars.com> May 31 2005
- Trevor Parscal <trevorparscal hotmail.com> May 31 2005
I know that the ~ is the greatest things since sliced arrays [ .. ] :) But when it comes to appending an array with a new element, I am feeling like I must be missing something.. Example: char[] word = "test"; char letter = '1'; // Wont work? word ~ letter; // Works fine... word.length = word.length + 1; word[word.length - 1] = letter; Why is this so complex to do? Is there a way I didn't learn from the D language docs? -- Thanks, Trevor Parscal www.trevorparscal.com trevorparscal hotmail.com
May 31 2005
"Trevor Parscal" <trevorparscal hotmail.com> wrote in message news:d7hq0e$1qgp$1 digitaldaemon.com...I know that the ~ is the greatest things since sliced arrays [ .. ] :) But when it comes to appending an array with a new element, I am feeling like I must be missing something.. Example: char[] word = "test"; char letter = '1'; // Wont work? word ~ letter;
Try word ~= letter;// Works fine... word.length = word.length + 1; word[word.length - 1] = letter; Why is this so complex to do? Is there a way I didn't learn from the D language docs? -- Thanks, Trevor Parscal www.trevorparscal.com trevorparscal hotmail.com
May 31 2005
"Trevor Parscal" <trevorparscal hotmail.com> wrote in message news:d7hq0e$1qgp$1 digitaldaemon.com...char[] word = "test"; char letter = '1'; // Wont work? word ~ letter;
Right, but that's a compiler bug. It'll be fixed in the next update.
May 31 2005
Walter wrote:"Trevor Parscal" <trevorparscal hotmail.com> wrote in message news:d7hq0e$1qgp$1 digitaldaemon.com...char[] word = "test"; char letter = '1'; // Wont work? word ~ letter;
Right, but that's a compiler bug. It'll be fixed in the next update.
Just what i always dreamed of, just one update away.. Walter = the man! -- Thanks, Trevor Parscal www.trevorparscal.com trevorparscal hotmail.com
May 31 2005









"John C" <johnch_atms hotmail.com> 