Skip to content

Commit

Permalink
util: add FloatToString() function
Browse files Browse the repository at this point in the history
  • Loading branch information
hoijui committed Feb 23, 2010
1 parent b692eb4 commit c26c98e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions rts/System/Util.h
Expand Up @@ -55,6 +55,13 @@ static inline std::string IntToString(int i, const std::string& format = "%i")
return std::string(buf);
}

static inline std::string FloatToString(float f, const std::string& format = "%f")
{
char buf[64];
SNPRINTF(buf, sizeof(buf), format.c_str(), f);
return std::string(buf);
}

/**
* @brief Safely delete object by first setting pointer to NULL and then deleting.
* This way it is guaranteed other objects can not access the object through the
Expand Down

0 comments on commit c26c98e

Please sign in to comment.