Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

apache commons lang StrTokenizer

Since I need empty tokens to read either as empty string or null, I decided to use the apache commons lang StrTokenizer But I am still not able to get the empty string. I know I need to set the setEmptyTokenAsNull method before I tokenize. But how can I do that? Please help.

tok = new StrTokenizer(line,","); 
tok.setEmptyTokenAsNull(true);
like image 887
javanerd Avatar asked Mar 11 '26 00:03

javanerd


1 Answers

Got it!! Used tok.setIgnoreEmptyTokens(false); instead!!

like image 138
javanerd Avatar answered Mar 13 '26 12:03

javanerd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!