Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def nthNumber(s, n)
- x = 0
- number = 0
- string = ""
- while (x < s.length)
- if s[x] >= '1' and s[x] <= '9' then
- number = number + 1
- while (true and x < s.length)
- if s[x] >= '0' and s[x] <= '9' then
- string = string + s[x]
- else
- break
- end
- x = x + 1
- end
- end
- if number == n then
- return string
- else
- string = ""
- end
- x = x + 1
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment