digitalmars.D - Appending Arrays
- Trevor Parscal (18/18) May 31 2005 I know that the ~ is the greatest things since sliced arrays [ .. ] :)
- John C (4/22) May 31 2005 Try
- Walter (3/7) May 31 2005 Right, but that's a compiler bug. It'll be fixed in the next update.
- Trevor Parscal (9/22) May 31 2005 Thank you, thank you, thank you, thank you....
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...Thank you, thank you, thank you, thank you.... Just what i always dreamed of, just one update away.. Walter = the man! -- Thanks, Trevor Parscal www.trevorparscal.com trevorparscal hotmail.comchar[] 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