+ 1

Split java negative arg

Why put a negative number arg to string split method in java? The result is the same without second arg... https://code.sololearn.com/cCOLoI2AGTjs/?ref=app

22nd Oct 2022, 7:07 AM
Roland
Roland - avatar
1 Réponse
+ 3
A positive number n means : maximum number of splits need is n. No beyond it. A negative number n means : split as many as possible. A number 0 means : split as many as possible but ignore or discard trailing empty strings. hope it helps..
22nd Oct 2022, 8:04 AM
Jayakrishna 🇮🇳