replace - Java Replacing all commas with semi-colons except the ones inside quotations marks -


replacing commas except ones inside quotations marks in java csv style user input.

i've done research can't wrap head around how/where start this, not sure if can ask questions without adding code but, if me suggesting functions use/research appreciate it

p.s i've seen few other posts read wasn't working properly.

2 suggestions:

  1. use csv parsing library commons-csv tokenize input , re-join whichever character want. csv libraries smart enough not split on commas within quotes.
  2. implement finite state machine (2 states: within quotes , outside quotes) scan input keeping track of whether or not current character inside quotes. when find comma , you're not inside quotes, replace it.

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -