How do I remove extra white spaces in a string?

How do I remove extra white spaces in a string?
trim() removes before and after spaces.
If I have a string "This is Test"
I want to remove extra spaces between words and also I want to keep SINGLE space
between words. So output should be "This is Test". Thanks.

replaceAll dosen't support with my version. Actually this works..............!!!!!!!!! Thank you.
                    java.util.StringTokenizer st = new java.util.StringTokenizer(brn, " \t");
                    StringBuffer buf = new StringBuffer();
                    while (st.hasMoreTokens()) {
                         buf.append(" ").append(st.nextToken());
                    String brn1 = buf.toString().trim();

Similar Messages

  • How do I remove the white space from the bottom and side of my document?

    How do I remove the white space from the bottom and side of my document? (I'm not talking about printing, just viewing it on the screen.) There are about 6 inches of white space at the bottom and at the right hand side. I don't like this. On a blank new spreadsheet it's triple that amount of white space.

    The infinite canvas convention doesn't make a lot of sense for Numbers. When I'm viewing a spreadsheet and mistakenly scroll into white, empty space I think, "this is ridiculous - all of my content is fits on one screen. there's nothing over there."
    A (relatively) infinite canvas is logical for Microsft Excel because it's one big table. There are 256(?) columns by default and hundreds of rows on a sheet - there are cells outside what a user is looking at to see. However, when viewing a Numbers spreadsheet with a single 10 column 10 row table that fits on the screen, there's nothing else on it to scroll to.
    Numbers should distinguish between viewing a spreadsheet and editing one. When I'm just viewing, when there's no content outside the window it shouldn't scroll there. This window behavior is beyond annoying for Numbers on my iPad and iPhone.
    (Adding user-defined canvas size setting to my view mode / edit mode thinking would probably be the most complete solution to this now that I think about it.)
    Until now the way scrolling worked in Numbers has defied logic. Actually it still does lol. That said, thank you Yellowbox for providing a clear explanation. Much appreciated.

  • When Importing Images, How Do I Remove The White Space Around The Corners?

    When Importing Images, How Do I Remove The White Space Around
    The Corners?

    u may use magic wand (and magic wand setting) from Lasson
    Tool to select and delete that white space, but u must break a part
    to the picture first.

  • Remove extra white space from an image

    I want to remove the extra white space in my image while writing it into a jpeg file using JPEGImageEncoder.
    Any help is welcome .

    ok.. Am having a JPanel whose width is set to 77000. But almost 60% of right hand side of the Panel is empty. I will create a BufferedImage from this component and then write it into a file using JPEGImageEncoder.
    The empty portion of the panel is coming as a white space in the image.
    Now how to remove this ? Was that clear enough ?

  • How do I remove the white space when importing a site from Flash?

    Okay, so I've dragged and dropped my created Flash site into Dreamweaver. One problem though, when I view it in a web browser (any web browser), it displays the site fine, however with a huge white space to the side of it. You'll see what I mean in this screenshot:
    What can I do then to remove that white space and make the site fill up the whole web browser? I've tried resizing it using a number of ways, but cannot seem to get it right.
    Thanks.

    function(){return A.apply(null,[this].concat($A(arguments)))}
    What can I do then to remove that white space and make the site fill up the whole web browser? I've tried resizing it using a number of ways, but cannot seem to get it right.
    You can do two things:
    1) Change the width of the container to 100%;  OR
    2) Post a link to your test page here (not the code nor picture) so that we can see ourselves what your code looks like.
    hth

  • Stripping extra white space from a string

    I am trying to strip extra spaces from a string, so it there are 2 or more spaces between a word I want to remove all but one. I am trying the following code
    getStringTwo().replaceAll("/\s+/is","");
    but all I get is an error saying Invalid escape sequence
    Thanks
    G

    >
    This strips out all the whitespace. I ended up
    getting round it by walking through the string and
    checking the values of each char and comparing that
    to the next value. What a wast of effortt A small modification of my earlier post gives -
    public class Test040320a
        public static void main(String[] args)
            String str = "this    is       a \t test";
            str = str.replaceAll("\\s+"," ");
            System.out.println(str);
    }

  • How do I remove the white space around a graphics I have placed?

    I am working on a pc.
    I have placed a graphic into my document that has a white box around it.
    I would like to get rid of the white box so only the graphic is seen.
    How do I accomplish that?

    wasenthay,
    If it is a raster image, this is best done in Photoshop, where you can just erase the white pixels (Magic Eraser or something). Without Photoshop, you will have to Image Trace to get a vector rendering which you may expand and then get rid of the white path/part, or to draw round the coloured parts and create a Clipping Mask or similar.
    If it is vector artwork, you should be able to just delete the white path(s)/part(s).

  • Placed Illustrator PDF has extra white space

    Illustrator  artwork saved as PDF, and placed on an InDesign page comes in with extra white space of around 1 1/3 mm on all 
    sides. I can't figure out what this unwanted white space is or how  to avoid it. Can someone please tell me how to avoid the  extra white space.

    in which case - i can only apologise for the incorrect advice.
    I've never had any problems with eps files - providing that the artwork is tidy.
    And I've found loads of problems printing a placed pdf through a digital rip.
    I'll leave it down to trial and error... and wish the best of luck.
    cheers
    re

  • How to remove the white space that is now above the main images on each page?

    http://www.nydogworks.net
    Hello,
    I took over updating some things on my site from my web designer. The main images on each page used to be flush with the navigation bar on each page. Now there is a white space in between each one. Can you tell me how to remove the white space?
    <div id="container">
    <div id="imgholder"><img src="images/feature-aboutus.jpg" width="951" height="341" alt="" />
    </div>
    <div id="pageContentNoside">
       <div id="sideSub">
         <form action="form.php" method="post" name="form2" id="form2"> <table width="250" border="0" cellpadding="2" cellspacing="2">
           <tr>
             <td width="273"><h2>Quick Contact</h2></td>
             </tr>
           <tr>
             <td class="mainContent">Your Name</td>
             </tr>
           <tr>
             <td><span class="style9">
               <input name="forname" type="text" class="colorfieldssmall" id="forname" size="20" />
               </span></td>
             </tr>
           <tr>
             <td class="mainContent">Your Email Address* (required)</td>
             </tr>
           <tr>
             <td><span class="style7 style9">
               <input name="admail" type="text" class="colorfieldssmall" id="admail" size="25" />
               </span></td>
             </tr>
           <tr>
             <td class="mainContent">Phone Number</td>
             </tr>
           <tr>
             <td><span class="style7 style9">
               <input name="phone" type="text" class="colorfieldssmall" id="phone" />
               </span></td>
             </tr>
           <tr>
             <td><span class="mainContent">Type of Dog Training</span></td>
             </tr>
           <tr>
             <td class="mainContent"><span class="style9">
               <select name="need" class="colorfieldssmall" id="need">
                 <option value="select one">select one</option>
                 <option value="Basic Obedience">Basic Obedience</option>
                 <option value="Behavior Therapy">Behavior Therapy</option>
                 <option value="Board and Train">Board and Train</option>
                 <option value="Off Leash Training">Off Leash Training</option>
                 <option value="Puppy Training">Puppy Training</option>
                 </select>
               </span></td>
             </tr>
           <tr>
             <td> </td>
             </tr>
           <tr>
             <td><div align="left">
               <input type="submit" name="submit" id="submit"  value="Submit" />
               </div>
               </td>
             </tr>
           </table></form>
         <h2><br />
           Dog Training Services<br />
           </h2>
         <ul id="subnav">
           <li><a href="basic-obedience.html">Basic Obedience</a></li>
           <li><a href="dog-behavior-therapy.html">Behavior Therapy</a></li>
           <li><a href="board-and-train-dog-program.html">Board & Train Program</a></li>
           <li><a href="off-leash-training.html">Off Leash Training</a></li>
           <li><a href="puppy-training-program.html">Puppy Training</a></li>
           </ul>
         <br />
         <br />
         <br />
         </div>
      <div id="suggestPost"><a href="https://www.facebook.com/pages/NYDogWorks/219268038151244?fref=ts" ></a></div>
       <div id="mainContent">
         <h1 class="copyrightType">About NY DogWorks</h1><br />
         <h2> <span class="testimonal">The Owner of NYDogWorks</span>      </h2>
         <p><span class="copyrightType"><img src="images/dogpic.jpg" alt="Dog Behavior Therapy" width="183" height="275" class="h_img_float_right" /></span><strong>NYDogWorks L.L.C. is owned and operated by Master Certified Dog Trainer and Behavior Specialist Brian DeMartino. </strong><br />
           <br />
           His training is hands down the best out there. He has become one of the most sought after dog trainers throughout Long Island, Manhattan, &amp; New York.<br />
           <br />
           With over 15 years experience training and rehabilitating some of the toughest cases of dog behaviors. He’s Mastered the Art of teaching top knotch obedience and manners with outstanding results and has developed the most full proof and guaranteed system to fully housebreak any puppy or dog in the shortest amount of time.<br />
           <br />
           He is Certified in dog training and dog behavior and is an Official Evaluator for the American Kennel Club’s (C.G.C) Program.<br />
           <br />
           <br />
           <strong>All About NYDogWorks</strong><br />
           </p>
      <p><br />
      </p>
         <p>NYDogWorks Dog Education, is a Professional Dog Training Company offering dog training for puppies and older dogs through customized in-home training programs by Master Certified Trainers in Nassau County, Suffolk County, Hamptons, Long Island, Manhattan, Brooklyn, Bronx, Queens, Rockland County, Westchester County, Orange County, and Bergen County New Jersey. NYDogWorks offers obedience training, Housebreaking, Manners, socialization for your dog,  Puppy Training and Education, Behavior Therapy, Trick Training, Agility, Complete Off Leash Training, Sport Work, and Personal Protection Training. <br />
           <br />
           <strong><br />
             NYDogWorks Boarding &amp; Training Programs</strong><br />
           </p>
      <p><br />
        We offer boarding and training programs done in the home of owner, Brian DeMartino. This is a customized 2-6 week program to suit your dog's needs, great for someone who feels they do not have the time or patience to train or rehabilitate their dog at their home. This is a 100% guaranteed program. Your dog will stay with us for no additional charge if we feel that he or she has not learned all that was agreed upon. We guarantee that if there is any regression within 3 months of your dog being back home with you, he/she will come back to us for no additional charge.<br />
        <br />
        <a href="board-and-train-dog-program.html">View Boarding &amp; Training Programs</a></p>
         <p><br />
           </p>
         <p><br />
           <br />
      </div>
       <div id="breadCrumbs">
         <p><a href="index.html">Home</a> &gt;  NY DogWorks - About Certified Dog Trainer Brian DeMartino<br />
           <strong>Serving all of Long Island, Nassau &amp; Suffolk County, Manhattan, Brooklyn &amp; Queens</strong></p>
         </div>
    </div>
        <div id="footer">
          <div id="footermenu">
          <div id="footermenu1">
          </div>
        </div>
       <div class="phoneNumber" id="copyright"> Copyright © 2014  NY DogWorks</div>
         <div class="websiteDesign" id="sitedesigner">Long Island Website Design by <a href="http://www.wetribet.com" title="Wet Ribet" target="_blank" class="medlink">Wet Ribet</a>     </div>
    </div>
    </div>

    You should be able to add the following snippets of css to your stylesheet to fix that.
    In the mainstyle.css file, change...
    #imgholder {
    width: 950px;
    margin-top: 0px;
    padding: 0px;
    margin-right: auto;
    margin-left: auto;
    to
    #imgholder {
    width: 950px;
    margin-top: 0px;
    padding: 0px;
    margin-right: auto;
    margin-left: auto;
    overflow:hidden;

  • How do i either colorize, or remove, the white spaces?

    This is my first web site design and I am using the CSS style twoColLiqRtHdr. I have changed the background color to every division but a white space remains around and below my left hand / main content column. I presume this has to do with the 'liquid' element of the style - and I even figured out how to fix the problem below my RH column but I am at an impass regarding the left side....

    Nancy - thanks for getting back to me. I am in flux as my domain name is in the process of being transferred, as we speak, and therefore I cannot provide a URL at this time. My background color is solid, and is the same, for every division.I assumed that there was some simple, standard way to 'stretch' the left column so it snugged up to everything else which I just was not seeing... AS you may have guessed from my e-mail address I am a photographer by trade - not a web master!  I will take a look at the demo that you provided the link to.  Maine-ah
    Date: Fri, 15 Jan 2010 14:36:49 -0700
    From: [email protected]
    To: [email protected]
    Subject: How do i either colorize, or remove, the white spaces?
    For best results in this forum, please provide us with a URL to your test site so we can see what you see. The answers are in your CSS and HTML code.
    Based on what little info you've provided, I'm guessing you're grappling with how to achieve equal height columns with CSS.
    DEMO of  2-col CSS layout
    http://alt-web.com/TEMPLATES/2-col-fixed-layout.shtml
    If you add a 2-toned, repeating background image to your #wrapper, you can create the illusion of equal height columns. This technique is called Faux Columns.
    *DEMO of Faux Columns -
    http://alt-web.com/TEMPLATES/2-column-fixed-width-template.shtml
    Hope this helps.  If it doesn't, please post back with a link to your page.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://www.alt-web.com/
    http://www.twitter.com/altweb
    http://www.alt-web.blogspot.com/
    >

  • How to remove the white space the in Excel  output

    Hi All,
    I was working with Oracle Apps r12.
    We have developed a custom report using xml and the report output type is Excel. when ran the report it completed with normal and the excel output is generated,We have a column called Amount and its having a white space before the amount.
    So that we cannot able to do any aggregate function with that data.
    For example the column called Amount
    28523.20
    32569.00
    25369.25
    in excel the output is coming like this, So when we select this three column and try to do any aggregate function it not giving any value.
    I have tried Trim but its dos'nt works, because the values are already trimed.
    Can any one could help on this.
    Thanks & regards
    Srikkanth

    Hi All,
    solved.
    Using this link i have removed the white space in my rtf and the white space in excel has removed
    http://office.microsoft.com/en-in/word-help/show-or-hide-formatting-marks-HP005189641.aspx
    Regards
    Srikkanth

  • How to extract ALL text on a line, including extra white space, from PDF?

    I have written my first scripts to parse thru PDF files and successfully locate the beginning and ending of text portions that I wish to copy/extract.  For example, one of the scripts reads thru PDF files and locates patterns that allow me to copy/extract a lengthy Title that spans several lines on the page.  My remaining problem is that sometimes the text I wish to copy/extract has tabs or lots of white space between the words, and I need to retain ALL the "white space" between words.  Basically, I am successful at using getPageNthWord(j, i, false) along with "Quad coordinate sets" to get a word-at-a-time for all the words on the multiple lines but it seems to be skipping over the tabs and extra white spacing beetween the words.   Another way to say this is that I need to extract/copy a full line at a time, including all white space, instead of being limited to just a word at a time. 
    Can anyone help me with an algorithm to extract/copy text, not just the words but also including tabs and other extra white space characters? Is there some type of Regular Expression I should be using, or maybe some additional parameter used for getPageNthWord that would retain all the extra white space?
    Thanks in advance,
    Ted L

    Did you try setting the bStrip parameter of getPageNthWord to false? It will
    preserve some of the whitespace, but not all of it.
    As far as I know, that's the only way to do it via a script.

  • Extra White Space Around Header Graphic & NavBar

    I have a header graphic and Navigation Bar (rollover images)
    positioned inside a table. Unfortunately, there is about 1-2 pixels
    of white space on the left, right, and top of the header graphic.
    Same with the NavBar--there's 1-2 pixels of white space on the
    edges (left & right sides). By default, cell padding for the
    table is set to zero. If cell padding is set to zero, why am I
    seeing white space between the edge of the graphic and the edge of
    the table?
    You can see what I'm referring to here:
    http://newstartinvestment.com
    What is causing this extra white space, and how do I get rid
    of it?

    On 26 Mar 2007 in macromedia.dreamweaver, csbridges wrote:
    > I have a header graphic and Navigation Bar (rollover
    images)
    > positioned inside a table. Unfortunately, there is about
    1-2 pixels
    > of white space on the left, right, and top of the header
    graphic.
    > Same with the NavBar--there's 1-2 pixels of white space
    on the edges
    > (left & right sides). By default, cell padding for
    the table is
    > set to zero. If cell padding is set to zero, why am I
    seeing white
    > space between the edge of the graphic and the edge of
    the table?
    >
    > You can see what I'm referring to here:
    >
    http://newstartinvestment.com
    (Btw, I
    > don't like the yellow rollovers--they'll be removed
    shortly.)
    >
    > What is causing this extra white space, and how do I get
    rid of it?
    Personally, I thought that the white border was a feature,
    but... In
    addition to the cellpadding, add cellspacing:
    <table width="780" border="0" align="center"
    cellpadding="0"
    cellspacing="0" bordercolor="#000000" bgcolor="#FFFFFF">
    Joe Makowiec
    http://makowiec.net/
    Email:
    http://makowiec.net/contact.php

  • Extra white space in Firefox, not IE

    Hello. I'm new to Dreamweaver and am having an issue I can't
    figure out. I was hoping someone might have insight into where my
    problem is.
    In the following site,
    http://www.firststepshr.biz,
    it previews as designed in Internet Explorer. However, in Firefox,
    extra white space (or blue background on the home page) is
    appearing above and below the Flash header. I can't, for the life
    of me, figure out why there's this difference.
    Anyone have any ideas? Thanks, in advance, for the advice.
    Jeremy

    I don't see extra white space in FF2x.
    If you want to use Flash for navigation, consider this -
    1. Some people don't have Flash installed - what do they do?
    2. Search engines may not parse Flash links - your site will
    not be
    spidered
    3. Screen assistive devices don't parse Flash links - what
    will those users
    do?
    4. DW cannot maintain links within a Flash movie, so if you
    move or rename
    a linked file, your navigation will break - what will you do?
    You will have
    to remake those buttons.
    It's usually a very bad idea for these reasons - and for
    these reasons,
    Adobe has removed Flash buttons and Flash text from the next
    version of
    Dreamweaver.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "dwellingproductions" <[email protected]>
    wrote in message
    news:gckfd0$odl$[email protected]..
    > Hello. I'm new to Dreamweaver and am having an issue I
    can't figure out.
    > I
    > was hoping someone might have insight into where my
    problem is.
    >
    > In the following site,
    http://www.firststepshr.biz,
    it previews as
    > designed in
    > Internet Explorer. However, in Firefox, extra white
    space is appearing
    > above
    > and below the Flash header. I can't, for the life of me,
    figure out why
    > there's this difference.
    >
    > Anyone have any ideas? Thanks, in advance, for the
    advice.
    >
    > Jeremy
    >

  • Why is there extra white space at the top of swf file?

    I can't figure out how to get rid of extra white space in the browser at the top of a swf file. It looks fine when I preview the file, but when I do publish preview in flash/ try to incorporate in HTML, there's an extra 1/4" at top of window.

    Do you have the html page (that you have the swf file embedded into) set so that there are no page margins? Your "body" tag should look like this…
    <body leftmargin="0" marginheight="0" marginwidth="0" topmargin="0">

Maybe you are looking for