• Post Reply Bookmark Topic Watch Topic
  • New Topic

Remove unwanted \n

 
Brendan Caden
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have a file that represents a database table delimited with pipe characters. \u007c. I need to give this file to someone who has an import application that presumes each new line is a new record - the trouble is my export contains return characters in free text fields so the return character is not necisarily the end of the record.

I know how many fields are in the table so I want to count the pipes - if I come across a return and I have not reached the required number of pipes(the end of the record) I want to delete the return and posibly replace it with some other character for information.

I am new to Java, I don't want someone to write my code just point me in the right direction.

Thanks
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the method replaceAll in String. You can change all occurrences of a character or group of characters.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!