Results 1 to 3 of 3
  1. #1
    lordj is offline Member
    Join Date
    Jun 2011
    Posts
    2
    Rep Power
    0

    Question Possible to ignore escape sequences?

    Hello all,

    I have been working on an application that involves the user typing in the path to a file (I don't want to use the FileChooser at this point). However, when it asks for the file path string you have to escape every directory '\'. So this is what you would need to point to a file: "C:\\path\\to\\file". Is there anyway that I can have the string ignore the '\' escape sequence?

    I'm not sure if this is regex material or not, because if so I have no idea how that would work..

    Thanks,
    lordj

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,532
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by lordj View Post
    Hello all,

    I have been working on an application that involves the user typing in the path to a file (I don't want to use the FileChooser at this point). However, when it asks for the file path string you have to escape every directory '\'. So this is what you would need to point to a file: "C:\\path\\to\\file". Is there anyway that I can have the string ignore the '\' escape sequence?
    This is not entirely true; if you specify a String literal to the compiler it'll translate the String as you've shown above, but if you, say, read a String from the user input, no escaping or String processing happens, i.e. a double \ stays a double \; it is also no regexp issue.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    lordj is offline Member
    Join Date
    Jun 2011
    Posts
    2
    Rep Power
    0

Similar Threads

  1. Replies: 1
    Last Post: 05-26-2011, 10:14 AM
  2. for loops and escape sequences
    By orangefest in forum New To Java
    Replies: 1
    Last Post: 04-19-2009, 08:55 PM
  3. Generating number sequences
    By hawkmauk in forum New To Java
    Replies: 0
    Last Post: 11-15-2007, 03:32 PM
  4. Oracle sequences
    By orchid in forum JDBC
    Replies: 5
    Last Post: 04-19-2007, 03:47 PM

Tags for this Thread

Posting Permissions

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