Advertisement
einsteinmaster96

StringHelper

Jun 27th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.38 KB | None | 0 0
  1. function getWords(str)
  2.     words = {}
  3.     sp = 1
  4.     while sp do
  5.         sp,ep = string.find(s," ")
  6.         if sp then
  7.             table.insert(words,string.sub(s,1,sp-1))
  8.             s = string.sub(s,sp+1)
  9.         else
  10.             table.insert(words,s)
  11.         end
  12.     end
  13.     return words
  14. end
  15. function boolStrToNumber(str)
  16.     if str then
  17.         if str == "true" then
  18.             return 1
  19.         elseif str == "false" then
  20.             return 0
  21.         end
  22.     end
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement