D - concatenating char's with char arrays
- "Charles Sanders" <sanders-consulting comcast.net> Oct 22 2003
- Helmut Leitner <helmut.leitner chello.at> Oct 22 2003
- "Sean L. Palmer" <palmer.sean verizon.net> Oct 23 2003
- "Vathix" <vathix dprogramming.com> Oct 23 2003
- Hauke Duden <H.NS.Duden gmx.net> Oct 23 2003
- "Nicolas Repiquet" <deadcow-remove-this free.fr> Oct 23 2003
Will this ever be possible ? char [] str = 'A' ~ " string"; ( im actually running through a string in a for loop , and it doesnt allow casting from char to char [] ) C
Oct 22 2003
Charles Sanders wrote:Will this ever be possible ? char [] str = 'A' ~ " string"; ( im actually running through a string in a for loop , and it doesnt allow casting from char to char [] )
I think all primitives should at least have a toString property. For the Moment you could use a canonical function alias char [] String; String CharRetString(char c) { String s="?"; s[0]=c; return s; } String s= CharRetString('A') ~ "abc"; -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com
Oct 22 2003
It seems like converting a basic type like char or int to a slice char[] or int[] would not only be possible, but cheap as well. It's a one-dimensional, single element array! ;) Sean "Helmut Leitner" <helmut.leitner chello.at> wrote in message news:3F976AD2.9F703033 chello.at...Charles Sanders wrote:Will this ever be possible ? char [] str = 'A' ~ " string"; ( im actually running through a string in a for loop , and it doesnt
casting from char to char [] )
I think all primitives should at least have a toString property. For the Moment you could use a canonical function alias char [] String; String CharRetString(char c) { String s="?"; s[0]=c; return s; } String s= CharRetString('A') ~ "abc";
Oct 23 2003
"Helmut Leitner" <helmut.leitner chello.at> wrote in message news:3F976AD2.9F703033 chello.at...Charles Sanders wrote:Will this ever be possible ? char [] str = 'A' ~ " string"; ( im actually running through a string in a for loop , and it doesnt
casting from char to char [] )
I think all primitives should at least have a toString property. For the Moment you could use a canonical function alias char [] String; String CharRetString(char c) { String s="?"; s[0]=c; return s; } String s= CharRetString('A') ~ "abc"; -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com
That code looks bad. Remember we're not supposed to write over string literals; and why the String? Here's what I do: char ch = 'A'; char[] s = (&ch)[0 .. 1] ~ "abc";
Oct 23 2003
Vathix wrote:alias char [] String;
String s="?"; s[0]=c;
That code looks bad. Remember we're not supposed to write over string literals;
Have I ever mentioned that I think D needs a true const type modifier? ;)
Oct 23 2003
"Charles Sanders" <sanders-consulting comcast.net> a écrit dans le message news: bn7b4e$1t8o$1 digitaldaemon.com...Will this ever be possible ? char [] str = 'A' ~ " string"; ( im actually running through a string in a for loop , and it doesnt allow casting from char to char [] )
char [] str = "hell"; str ~= 'o'; this works. char[] str = "hell"; str = str ~ 'o'; this dont. I ask walter for this, and i was answered that it is a bug, and it'll be fixed soon. -- Nicolas Repiquet
Oct 23 2003









"Sean L. Palmer" <palmer.sean verizon.net> 