summaryrefslogtreecommitdiffstats
path: root/src/StringUtils.cpp
diff options
context:
space:
mode:
authorAlex Sweet <sweet.giorni@gmail.com>2018-04-11 08:46:11 +0200
committerAlexander Harkness <me@bearbin.net>2018-04-11 08:46:11 +0200
commita0896c63d7a02d1b90572d591a16a79b4274feac (patch)
treee3b58fdc79e6891181e057824c8a39769da4ee72 /src/StringUtils.cpp
parentFix cUUID::Variant (#4213) (diff)
downloadcuberite-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 'src/StringUtils.cpp')
-rw-r--r--src/StringUtils.cpp12
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;
+}
+