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 » short-hand
Re: short-hand [message #3418 is a reply to message #3415] Wed, 24 May 2006 13:12 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14266
Registered: November 2005
Ultimate Member
qwerty wrote on Wed, 24 May 2006 06:04

is there any short-hand for something like this:

Array<int> ints;
String str = "";

... - adds some elements to 'ints'

for(int q = -1; ++q < ints.GetCount(); ) {
    str += AsString(ints.[q]) + " ";
}


?

excluding
for(int q = -1; ++q < ints.GetCount(); str += AsString(ints.[q]) + " "); Surprised



Well, not much better, but

for(int q = 0; q < ints.GetCount(); i++) // you can keep your version here too, I like this better...
   str << ints[q] << ' ';


..as operator<< for Stream and String translates to calling AsString...

Not that using "<<" is also faster here (because you are adding to existing string, instead of concating and adding...)

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How Use Substring Search?
Next Topic: user 'Value' [FEATURE REQUEST]
Goto Forum:
  


Current Time: Sun Jul 20 05:35:39 CEST 2025

Total time taken to generate the page: 0.00287 seconds