digitalmars.D.learn - char[] -> int or float...
- Gregor Kopp (4/4) Mar 27 2007 Hi Guys,
- Daniel Keep (13/19) Mar 27 2007 http://www.digitalmars.com/d/phobos/std_conv.html
- Gregor Kopp (1/3) Mar 27 2007 Thank you very much!
- Gregor Kopp (10/15) Mar 27 2007 Okay, i figured it out how to do the conversion from char[] into a
- Aarti_pl (27/45) Mar 27 2007 Please see to std.string module:
- Gregor Kopp (2/2) Mar 27 2007 shame on me :(
- Ary Manzana (5/53) Mar 27 2007 A "see std.string for convertions in the other way" would be nice in the...
- Tomas Lindquist Olsen (3/58) Mar 27 2007 Personally I think having them in seperate modules is a mistake. both
- Chris Nicholson-Sauls (4/60) Mar 27 2007 Or just place a public import of std.string in std.conv. That would do ...
- Bill Baxter (3/58) Mar 27 2007 The comments pages are your friends. Add the link there.
Hi Guys, can anyone tell me how I can convert a char-Array to a float or an int? Kind Regards, Gregor
Mar 27 2007
Gregor Kopp wrote:Hi Guys, can anyone tell me how I can convert a char-Array to a float or an int? Kind Regards, Gregorhttp://www.digitalmars.com/d/phobos/std_conv.html Documentation is your friend. -- Daniel -- int getRandomNumber() { return 4; // chosen by fair dice roll. // guaranteed to be random. } http://xkcd.com/ v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
Mar 27 2007
Daniel Keep wrote: http://www.digitalmars.com/d/phobos/std_conv.htmlThank you very much!
Mar 27 2007
Gregor Kopp wrote:Okay, i figured it out how to do the conversion from char[] into a float. I searched now for about 2 hours how to make this in the other direction: float -> char[] Or any other buildin type (int, flaot, double, etc.), but I couldn't find any useful information about this in the documention. Is there any good documention outside there how to convert between different types including char[]? Or generally a tutorial or documentation about handling char[] and conversion? Regards, GregorDaniel Keep wrote: http://www.digitalmars.com/d/phobos/std_conv.htmlThank you very much!
Mar 27 2007
Gregor Kopp napisał(a):Gregor Kopp wrote:Please see to std.string module: char[] toString(bool b); char[] toString(char c); char[] toString(ubyte ub); char[] toString(ushort us); char[] toString(uint u); char[] toString(ulong u); char[] toString(byte b); char[] toString(short s); char[] toString(int i); char[] toString(long i); char[] toString(float f); char[] toString(double d); char[] toString(real r); char[] toString(ifloat f); char[] toString(idouble d); char[] toString(ireal r); char[] toString(cfloat f); char[] toString(cdouble d); char[] toString(creal r); Convert to char[]. Documentation for Phobos is far from perfect, but you can find most necessary things anyway. Regards Marcin Kuszczak (aarti_pl)Okay, i figured it out how to do the conversion from char[] into a float. I searched now for about 2 hours how to make this in the other direction: float -> char[] Or any other buildin type (int, flaot, double, etc.), but I couldn't find any useful information about this in the documention. Is there any good documention outside there how to convert between different types including char[]? Or generally a tutorial or documentation about handling char[] and conversion? Regards, GregorDaniel Keep wrote: http://www.digitalmars.com/d/phobos/std_conv.htmlThank you very much!
Mar 27 2007
Aarti_pl escribió:Gregor Kopp napisał(a):A "see std.string for convertions in the other way" would be nice in the documentation (same for std.conv in the other way). Regards, AryGregor Kopp wrote:Please see to std.string module: char[] toString(bool b); char[] toString(char c); char[] toString(ubyte ub); char[] toString(ushort us); char[] toString(uint u); char[] toString(ulong u); char[] toString(byte b); char[] toString(short s); char[] toString(int i); char[] toString(long i); char[] toString(float f); char[] toString(double d); char[] toString(real r); char[] toString(ifloat f); char[] toString(idouble d); char[] toString(ireal r); char[] toString(cfloat f); char[] toString(cdouble d); char[] toString(creal r); Convert to char[]. Documentation for Phobos is far from perfect, but you can find most necessary things anyway. Regards Marcin Kuszczak (aarti_pl)Okay, i figured it out how to do the conversion from char[] into a float. I searched now for about 2 hours how to make this in the other direction: float -> char[] Or any other buildin type (int, flaot, double, etc.), but I couldn't find any useful information about this in the documention. Is there any good documention outside there how to convert between different types including char[]? Or generally a tutorial or documentation about handling char[] and conversion? Regards, GregorDaniel Keep wrote: http://www.digitalmars.com/d/phobos/std_conv.htmlThank you very much!
Mar 27 2007
Ary Manzana wrote:Aarti_pl escribió:Personally I think having them in seperate modules is a mistake. both toFloat(char[]) and toString(float) should be in std.conv IMHO!Gregor Kopp napisa?(a):A "see std.string for convertions in the other way" would be nice in the documentation (same for std.conv in the other way). Regards, AryGregor Kopp wrote:Please see to std.string module: char[] toString(bool b); char[] toString(char c); char[] toString(ubyte ub); char[] toString(ushort us); char[] toString(uint u); char[] toString(ulong u); char[] toString(byte b); char[] toString(short s); char[] toString(int i); char[] toString(long i); char[] toString(float f); char[] toString(double d); char[] toString(real r); char[] toString(ifloat f); char[] toString(idouble d); char[] toString(ireal r); char[] toString(cfloat f); char[] toString(cdouble d); char[] toString(creal r); Convert to char[]. Documentation for Phobos is far from perfect, but you can find most necessary things anyway. Regards Marcin Kuszczak (aarti_pl)Okay, i figured it out how to do the conversion from char[] into a float. I searched now for about 2 hours how to make this in the other direction: float -> char[] Or any other buildin type (int, flaot, double, etc.), but I couldn't find any useful information about this in the documention. Is there any good documention outside there how to convert between different types including char[]? Or generally a tutorial or documentation about handling char[] and conversion? Regards, GregorDaniel Keep wrote: http://www.digitalmars.com/d/phobos/std_conv.htmlThank you very much!
Mar 27 2007
Tomas Lindquist Olsen wrote:Ary Manzana wrote:Or just place a public import of std.string in std.conv. That would do the trick without either module getting too massive. -- Chris Nicholson-SaulsAarti_pl escribió:Personally I think having them in seperate modules is a mistake. both toFloat(char[]) and toString(float) should be in std.conv IMHO!Gregor Kopp napisa?(a):A "see std.string for convertions in the other way" would be nice in the documentation (same for std.conv in the other way). Regards, AryGregor Kopp wrote:Please see to std.string module: char[] toString(bool b); char[] toString(char c); char[] toString(ubyte ub); char[] toString(ushort us); char[] toString(uint u); char[] toString(ulong u); char[] toString(byte b); char[] toString(short s); char[] toString(int i); char[] toString(long i); char[] toString(float f); char[] toString(double d); char[] toString(real r); char[] toString(ifloat f); char[] toString(idouble d); char[] toString(ireal r); char[] toString(cfloat f); char[] toString(cdouble d); char[] toString(creal r); Convert to char[]. Documentation for Phobos is far from perfect, but you can find most necessary things anyway. Regards Marcin Kuszczak (aarti_pl)Okay, i figured it out how to do the conversion from char[] into a float. I searched now for about 2 hours how to make this in the other direction: float -> char[] Or any other buildin type (int, flaot, double, etc.), but I couldn't find any useful information about this in the documention. Is there any good documention outside there how to convert between different types including char[]? Or generally a tutorial or documentation about handling char[] and conversion? Regards, GregorDaniel Keep wrote: http://www.digitalmars.com/d/phobos/std_conv.htmlThank you very much!
Mar 27 2007
Ary Manzana wrote:Aarti_pl escribió:The comments pages are your friends. Add the link there. --bbGregor Kopp napisał(a):A "see std.string for convertions in the other way" would be nice in the documentation (same for std.conv in the other way). Regards, AryGregor Kopp wrote:Please see to std.string module: char[] toString(bool b); char[] toString(char c); char[] toString(ubyte ub); char[] toString(ushort us); char[] toString(uint u); char[] toString(ulong u); char[] toString(byte b); char[] toString(short s); char[] toString(int i); char[] toString(long i); char[] toString(float f); char[] toString(double d); char[] toString(real r); char[] toString(ifloat f); char[] toString(idouble d); char[] toString(ireal r); char[] toString(cfloat f); char[] toString(cdouble d); char[] toString(creal r); Convert to char[]. Documentation for Phobos is far from perfect, but you can find most necessary things anyway. Regards Marcin Kuszczak (aarti_pl)Okay, i figured it out how to do the conversion from char[] into a float. I searched now for about 2 hours how to make this in the other direction: float -> char[] Or any other buildin type (int, flaot, double, etc.), but I couldn't find any useful information about this in the documention. Is there any good documention outside there how to convert between different types including char[]? Or generally a tutorial or documentation about handling char[] and conversion? Regards, GregorDaniel Keep wrote: http://www.digitalmars.com/d/phobos/std_conv.htmlThank you very much!
Mar 27 2007