Added world creation menu
This commit is contained in:
@@ -131,4 +131,22 @@ bool util::is_integer(string text) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool util::is_integer(wstring text) {
|
||||
for (wchar_t c : text) {
|
||||
if (c < L'0' || c > L'9')
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool util::is_valid_filename(std::wstring name) {
|
||||
for (wchar_t c : name) {
|
||||
if (c < 31 || c == '/' || c == '\\' || c == '<' || c == '>' ||
|
||||
c == ':' || c == '"' || c == '|' || c == '?' || c == '*'){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -13,6 +13,8 @@ namespace util {
|
||||
extern std::string wstr2str_utf8(const std::wstring ws);
|
||||
extern std::wstring str2wstr_utf8(const std::string s);
|
||||
extern bool is_integer(std::string text);
|
||||
extern bool is_integer(std::wstring text);
|
||||
extern bool is_valid_filename(std::wstring name);
|
||||
}
|
||||
|
||||
#endif // UTIL_STRINGUTIL_H_
|
||||
Reference in New Issue
Block a user