Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: A very simple question...

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default A very simple question...

    I am looking through a piece of code and I cannot figure out what this does. I have seen it in other code but as I am just learning java, I was hoping someone could tell me about it. Here is the code snipet:

    line = line.replaceAll("\t", " ");

    My question is what does \t do in Java???


  2. #2
    Member snowguy13's Avatar
    Join Date
    Nov 2011
    Location
    In Hyrule enjoying a chat with Demise and Ganondorf
    Posts
    339
    My Mood
    Happy
    Thanks
    31
    Thanked 48 Times in 42 Posts

    Default Re: A very simple question...

    \t is an escape sequence that represents a tab. When a String contains a \t in it, a tab will be shown when that String is displayed in the terminal (however, this does not always work in components).
    Use highlight tags to help others help you!

    [highlight=Java]Your prettily formatted code goes here[/highlight]

    Using these tags makes your code formatted, and helps everyone answer your questions more easily!




    Wanna hear something funny?

    Me too.

  3. #3
    Junior Member lunix's Avatar
    Join Date
    Apr 2012
    Location
    England
    Posts
    6
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: A very simple question...

    Partly related to regular expression, the code is finding any tab indentation and replacing it with a single space...check regular expression and escape sequences for more information regarding the \t
    Feels good man

Similar Threads

  1. Simple I/O Question...well could be simple for you?
    By basketball8533 in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: September 30th, 2011, 06:44 AM
  2. Simple question
    By white97 in forum Java Theory & Questions
    Replies: 1
    Last Post: August 11th, 2011, 06:30 PM
  3. Just a simple question
    By newbie in forum Java Theory & Questions
    Replies: 10
    Last Post: December 6th, 2010, 08:19 PM
  4. simple question...
    By chronoz13 in forum Java Theory & Questions
    Replies: 2
    Last Post: February 2nd, 2010, 07:29 AM
  5. not so simple, simple swing question box
    By wolfgar in forum AWT / Java Swing
    Replies: 2
    Last Post: November 20th, 2009, 03:47 AM