Jump to content

string.find question


Recommended Posts

Here is my function called decodeAndFindString.

  
function decodeAndFindString(theString, takeOut) 
    if tostring(theString) and tostring(toFind) then 
        return string.find(string.lower(tostring(theString):gsub('#%x%x%x%x%x%x', '')), tostring(toFind)) 
    end 
end 
  
  

decodeAndFindString(string, find)

String is what we are trying to find something in and Find is what we are trying to find.

For example if decodeAndFindString("UpperLowerHAPPYpLaYeR", "player")

It will return true 'cos it found player.

string.lower(string) converts to lowercase

string.upper(string) converts to uppercase

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...