Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2010
    Posts
    80
    Rep Power
    0

    Default Convert dash to underscorde

    Hi

    I have transferred Cobol program to Java program. After the tranfromation I got Java file its variables have - "dash". The problem is that Java considers this as subtraction.

    I know there is a method that takes the java file and converts each - to _

    Could you please tell me what the method is ?

    Thank you

  2. #2
    Stamoulohta is offline Member
    Join Date
    Mar 2011
    Posts
    26
    Rep Power
    0

    Default

    Don't know if i understood that right, but you can try String.replace() or even better
    linux sed...

  3. #3
    santeron is offline Member
    Join Date
    Apr 2011
    Location
    Athens, Greece
    Posts
    52
    Rep Power
    0

    Default

    If I get it right you want to change the chars inside the .java file? Use a text editor and do edit --> replace and make it search for "-" and convert it to "_" but be sure to do it one by one and not replace all because it could brake your code if there is a dash somewhere that is needed...

  4. #4
    Join Date
    Jan 2010
    Posts
    80
    Rep Power
    0

    Default

    Quote Originally Posted by Stamoulohta View Post
    Don't know if i understood that right, but you can try String.replace() or even better
    linux sed...
    I'll try it

    Thanks

  5. #5
    Join Date
    Jan 2010
    Posts
    80
    Rep Power
    0

    Default

    Quote Originally Posted by santeron View Post
    If I get it right you want to change the chars inside the .java file? Use a text editor and do edit --> replace and make it search for "-" and convert it to "_" but be sure to do it one by one and not replace all because it could brake your code if there is a dash somewhere that is needed...
    No I need to use a method in Java to replace.

    Thanks.

Similar Threads

  1. draw smooth dash-ed line
    By sarveshwar in forum Java 2D
    Replies: 3
    Last Post: 03-01-2011, 08:23 AM
  2. cannot convert from int to int[][]
    By besweeet in forum New To Java
    Replies: 9
    Last Post: 04-18-2010, 04:36 AM
  3. Convert to Int
    By 6kyAngel in forum New To Java
    Replies: 0
    Last Post: 03-06-2009, 10:18 AM
  4. how to convert xml to xsd
    By adi in forum XML
    Replies: 2
    Last Post: 02-12-2009, 03:43 PM
  5. need the help to convert to and from UTF-8 and UCS-2
    By sachin_n in forum Advanced Java
    Replies: 1
    Last Post: 01-05-2009, 10:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •