Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
String Searcher
--String Searcher by T()m local searchString = "Lua-5.3" --//What to search local searchFor = "Lua" --//What to find in searchString local caseSensitive = true --//If false, uses string.lower to have non-"case sensitive" local stringLength = string.len(searchString) local startSub = 1 local found = false local endSub = string.len(searchFor) print("Length: "..stringLength) if not caseSensitive then searchString = string.lower(searchString) searchFor = string.lower(searchFor) end for search = 1, stringLength do if string.sub(searchString, startSub, endSub) == searchFor then found = true else startSub = startSub + 1 endSub = endSub + 1 end end if found then print("Found "..searchFor.." in "..searchString.." @ sub("..startSub..", "..endSub..")") else print("Could not find "..searchFor.." in "..searchString) end
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
roulette
Enums in Lua (library)
Replace all substring in string
Hand positions in a circle
char2int & int2char encoding
BasicTablePrinterV2
Hello 2
dd
Fixed
Creating habits. Lua
Please log in to post a comment.