• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

how to remove ^M programatically

 
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 27214
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use regular expression to replace all the control characters with empty string, e.g. str.replaceAll("\\p{Cntrl}", "");
 
I claim this furniture in the name of The Ottoman Empire! You can keep this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic