Home » U++ Library support » U++ Core » int <-> String conversions
Re: int <-> String conversions [message #647 is a reply to message #622] |
Mon, 23 January 2006 16:28  |
 |
mirek
Messages: 14267 Registered: November 2005
|
Ultimate Member |
|
|
int->String:
AsString(x)
BTW, AsString is the "standard" function, it is implemented for many types. Moreover, templated
operator<<(String&, T)
and
operator<<(Stream&, T)
are implemented to use AsString, so in most cases, when putting things together, you do not need to care and just put any type on the right side of "<<":
String r; // or e.g. FileOut r;
int i;
Date d;
r << "The number is: " << i << " and the date is: " << d;
String->int:
Well, you can use c library atoi for simple cases. If you are about to have Null option for the empty string, you can use StrIntValue function.
However, in most cases, this is the part of wider text parsing code and that domain is completely ruled by CParser - simple, but extremely useful lexical parser.
|
|
|
Goto Forum:
Current Time: Sun Aug 17 01:08:16 CEST 2025
Total time taken to generate the page: 0.05257 seconds
|