Support quotation nested, comma segmentation
Private Static String [] CVSField (String Line) {list <string> Fields = New LINKEDList <(); Char [] alpah = line.tocharray (); t pos = 0; int len = 0; Boolean yinhao = false; for (char c: alpah) {if (isfieldStart) {len = 0; isfieldStart = false;} if (c == '/"') {yinhao =! yinhao;} if (c == ' , '&&! yinhao) {Fields.add (New String (Alpah, POS -Len, Len, Len)); IsfieldStart = TRUE;} POS ++; Len ++;} Return Fields.toarray (New String [0]); }
The above is all the contents of this article. I hope everyone can like it.