Skip to main content
gamedev.net
🔒 Locked

stringops

Started by Ronin Magus 1 reply 250+ views
Original Post
Ronin Magus
Ronin Magus
I''ve noticed a lot of questions around here about converting primitive data types to and from strings. So I decided to write a simple little include file that handles conversion from ints and doubles to and from strings, as well as whitespace trimming. Just simply include stringops.cpp into your project. it''s available free for any use whatsoever here: http://roninmagus.hopto.org/extra/stringops/stringops.cpp Let me know what you think! Also, let me know if you see any problems with it, so I can fix my own code!
Beer Hunter
Beer Hunter
As useful as such functions are, I prefer the approach taken by boost::lexical_cast - it puts the value on to a stringstream, reads it off, then checks that the entire stringstream was read (after trimming whitespace).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.