This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
i have an String which has as an comma separated value example:"1,2,3,4,5,6,7,8,...,3500"
the comma separated value has more than 2000 value how can i split by comma from 1 to 999 and from 999 to 1998.
can you provide the solution for the above question ASAP
It seems you can't use a generic solution like String.split or something similar, so the solution to your problem is parse manually the String.
You can do that by getting each char in a loop, put chars in a current string, when you encounter the "," char you interpret the current string as number, and go over and over again.
Right, I was thinking in the first time on that. By "can't use" I mean "is not appropriate to use". I was thinking that if he don't want to have many values parsed, than perhaps he does not want all value parsed.
Technically I totally agree with your solution.
Another option... instead of using the regex split() method, you could use the regex find() method. With find(), you can defined the token to include, up to 999 values separated by commas -- and hence, no need to split and remerge 999 items.