• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to remove ^M programatically  RSS feed

 
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

does anyone know how i can remove the ^M character programatically, i could use the dos2unix but i'd like to see if i could remove it with a java program before the other route.

thanks
bc
 
Sheriff
Posts: 22846
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a newline character, isn't it? The way to represent one of those in Java is '\n' (for a char) or "\n" (for a string). I assume that is the root of what you are asking, I can't answer the question as stated because you haven't said what you want to delete it from.
 
bob connolly
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i've uploaded a bunch of .vb programs from DOS and am rebuilding the programs using Java so i can implant display statments, not sure if i am creating the ^M or if it already had the ^M:

^M
#Region "Controls"^M
^M
Protected WithEvents cmdHelp As System.Web.UI.WebControls.LinkButton^M
Protected WithEvents imgHelp As System.Web.UI.WebControls.Image^M
Protected WithEvents lblHelp As System.Web.UI.WebControls.Label^M
Protected WithEvents pnlHelp As System.Web.UI.WebControls.Panel^M
^M
#End Region^M
^M
#Region "Private Members"^M
^M
^M
 
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use regular expression to replace all the control characters with empty string, e.g. str.replaceAll("\\p{Cntrl}", "");
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!