Red Squirrel
[H]F Junkie
- Joined
- Nov 29, 2009
- Messages
- 9,211
I discovered this not too long ago, and it makes it 100 times easier to concatenate strings and ints together. Great for formulating SQL queries and such without the need to call int to string type functions.
I have never seen this in any tutorial or any examples when researching stuff. Is there any reason NOT to use this class when formulating strings? It seems like a HUGE life saver to me.
ex:
Instead of:
Where ConvertInt2Str() would be a custom function somewhere with some sprintf stuff. With ss, I don't need to make a custom function like this.
I have never seen this in any tutorial or any examples when researching stuff. Is there any reason NOT to use this class when formulating strings? It seems like a HUGE life saver to me.
ex:
Code:
stringstream ss;
ss<<"SELECT * FROM "<<db.tableprefix<<"_users WHERE regdate>"<<(curtime-3600)<<" limit 100";
query(ss.str());
Instead of:
Code:
string ss;
ss="SELECT * FROM " + db.tableprefix + "_users WHERE regdate>" + ConvertInt2Str(curtime-3600) + " limit 100";
query(ss);
Where ConvertInt2Str() would be a custom function somewhere with some sprintf stuff. With ss, I don't need to make a custom function like this.