edcoder
edcoder

Reputation: 533

LUA: String split after number of characters

I have a 18 digit number, and would like to split it into 2 portions( 9 digits each). Could you advice me about a way to go about it?

I tried the string.split and divide it with string.len but that doesn't seem to work.

Eg: number = 45698745896547854

Help would be appreciated.

Upvotes: 1

Views: 1574

Answers (1)

edcoder
edcoder

Reputation: 533

I did some thinking, and was able to solve it this way:

stringOne = string.sub(IHINumber, 1, 9)
stringTwo = string.sub(IHINumber, 10, 18)

Upvotes: 5

Related Questions