Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous message
mirek is currently offline  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.
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Need help...
Next Topic: regex (assembly) from boost
Goto Forum:
  


Current Time: Sun Aug 17 01:08:16 CEST 2025

Total time taken to generate the page: 0.05257 seconds