Jump to content

String.Find


#Paper

Recommended Posts

Posted

I'm working to new mapratings system, i want to get how many is rated one map

  
string.find( name, "l+") 
  

How i can get how many results there is for this string.find?

ty all! ^_^

mtaubluascripter.png

My skype: skiper964

I helped you? Help me! ^^

Help me bro! ^^

Posted

explain it better as i dont understand it..

you cant to count character instances in string?

like on every vote you are adding "+" to string, then you have like "+++++++" and want to count it? this is the way i understood it.

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
explain it better as i dont understand it..

you cant to count character instances in string?

like on every vote you are adding "+" to string, then you have like "+++++++" and want to count it? this is the way i understood it.

For example:

In a txt file I have the string with "hello" how can I do to have as many are there these strings?

mtaubluascripter.png

My skype: skiper964

I helped you? Help me! ^^

Help me bro! ^^

Posted

uhm, this is a bit weird way, but the simpliest i think

  
function countWord(text, word) 
  local changed, count = string.gsub(text, word, function() end) 
  return count 
end 
  

it will work only with simple words like : "hello".

it will fail if use with chars like

  
[ ] ( ) . * { } % 
  

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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...