seba123neo
seba123neo

Reputation: 4748

Create array from huge string by parts

I have this huge string

String vStr = "('1','uno'),('2','dos'),('3','tres'),('4','cuatro')...('1000000','one millon')"

when i use the

vStr.split('),(')

i have an error outOfMemory exception in string.split

How can I do a split ? but to 500 parts at the time ?

Upvotes: 0

Views: 51

Answers (1)

arias_JC
arias_JC

Reputation: 559

If you'd like to limit the number of resulting parts, just add desired parts as second argument of split() method.

vStr.split('),(', 500)

And maybe do this however many times you need in a loop or something.

Upvotes: 1

Related Questions