diff options
author | Alex Sweet <sweet.giorni@gmail.com> | 2018-04-11 08:46:11 +0200 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2018-04-11 08:46:11 +0200 |
commit | a0896c63d7a02d1b90572d591a16a79b4274feac (patch) | |
tree | e3b58fdc79e6891181e057824c8a39769da4ee72 /src/StringUtils.cpp | |
parent | Fix cUUID::Variant (#4213) (diff) | |
download | cuberite-a0896c63d7a02d1b90572d591a16a79b4274feac.tar cuberite-a0896c63d7a02d1b90572d591a16a79b4274feac.tar.gz cuberite-a0896c63d7a02d1b90572d591a16a79b4274feac.tar.bz2 cuberite-a0896c63d7a02d1b90572d591a16a79b4274feac.tar.lz cuberite-a0896c63d7a02d1b90572d591a16a79b4274feac.tar.xz cuberite-a0896c63d7a02d1b90572d591a16a79b4274feac.tar.zst cuberite-a0896c63d7a02d1b90572d591a16a79b4274feac.zip |
Diffstat (limited to '')
-rw-r--r-- | src/StringUtils.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp index b1f58f23c..ae0aec1ad 100644 --- a/src/StringUtils.cpp +++ b/src/StringUtils.cpp @@ -1051,3 +1051,15 @@ AString StringsConcat(const AStringVector & a_Strings, char a_Separator) } return res; } + +bool StringToFloat(const AString & a_String, float & a_Num) +{ + char *err; + a_Num = strtof(a_String.c_str(), &err); + if (*err != 0) + { + return false; + } + return true; +} + |