Skip to content
This repository has been archived by the owner on Sep 25, 2022. It is now read-only.

Commit

Permalink
Add: stringtools::Find() for check variable name.
Browse files Browse the repository at this point in the history
  • Loading branch information
ferhatgec committed Dec 10, 2020
1 parent e5d12e5 commit 60acf80
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Library/StringTools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,15 @@ namespace stringtools {
return mainString;
}

static bool Find(std::string &data, std::string substring) {
size_t check = data.find(substring);

if (check != std::string::npos) return true; /* Found */
else
return false; /* Not found */

return false;
}
}

#endif // STRING_TOOLS_HPP
2 changes: 1 addition & 1 deletion flascript/Interpreter/Interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ FInterpreter::FlaScriptInterpreter(flascript_t &data) {
name = stringtools::GetBetweenString(linebyline, _data + " -> ", " <-");
}

if(name.find(" ")) {
if(stringtools::Find(name, " ")) {
FlaScriptInterpreterWithArg(data.file,
"warning(\"file: " + data.file +
"\\ndata: " + linebyline + "\\n-> Whitespace detected.\\n" +
Expand Down

0 comments on commit 60acf80

Please sign in to comment.