Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fullString="1,5,10"
- function splitString(sourceString,splittingChar,index)
- for i=1,index do
- start,stop=string.find(sourceString,splittingChar)
- if start==nil then
- start=string.len(sourceString)+1
- stop=start
- end
- splittedString=string.sub(sourceString,0,start-1)
- sourceString=string.sub(sourceString,stop+1,string.len(sourceString))
- end
- return splittedString
- end
- print(splitString(fullString,",",3))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement