Jump to content

Remove parts from a string


tommymaster

Recommended Posts

Posted

Hi!
I have to problems. For example if i have a string like this: "INTERIOR: 10, OWNER = 1" how could i convert only "10" and only "1" to an int, a remove text from it?
And for example how to add / remove underlines ( _ ) between surname and last name?

Posted

local t1,t2 = string.split(string,',')

Or local t1,t2 = split(string,',')

One of those to split the string

Then 

string.gsub(t1,'INTERIOR: ','')

and

string.gsub(t2,'OWNER = ','')

  • Thanks 1

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