194 posts
Location
Spain
Posted 21 October 2012 - 03:29 PM
I want to get the last part of a path (a string). For example:
string="/programs/tests/helloWorld"
I need to get only the "helloWorld" part in another variable. How can I do that?
147 posts
Location
England
Posted 21 October 2012 - 04:01 PM
194 posts
Location
Spain
Posted 21 October 2012 - 04:19 PM
Edit: It didn't work. I do the same but with the pattern "/" but it returns only the "/". Do you know how to get the text betwen the "/"?
8543 posts
Posted 21 October 2012 - 05:35 PM
I want to get the last part of a path (a string). For example:
string="/programs/tests/helloWorld"
I need to get only the "helloWorld" part in another variable. How can I do that?
fs.getName()
194 posts
Location
Spain
Posted 21 October 2012 - 05:55 PM
fs.getName()
Thanks, I forget that that function exists xd.
318 posts
Location
Somewhere on the planet called earth
Posted 21 October 2012 - 07:19 PM
or you could do this to get it.
string="/programs/tests/helloWorld"
local file = string.match(string, "/(%w+)$")