How to detect  multiple white spaces?

Hi,
I am working on an assignment where I have to read from a file and initialize the fields of my graph based on the input.
My problem is determining the input to be assigned to some field with some rule on the input file.
The input file will consist of 2 city names and the distance between them.
- Zero or more space is allowed to preceed the first city name
- one or more space between first city and second city, - - one or more space between first city and distance.
Example:
San Diego Boston 150
So I have to assign city1 = San Diego
city2 = Boston
distance = 150
I tried to do it with string tokenizer and string manipulation(like indexOf() and length()) but it does not seem to be working.
Any help will be appreciated.
Thanks!

Sorry for the added ugliness, but this works:import java.util.regex.*;
public class Test
    public static void main(String[] args)
        String s = "    'San Diego' Boston    123   ";
        Matcher m = Pattern.compile("('[^']*')|([^ ']+)").matcher(s);
        while(m.find())
            String g = m.group(1);
            if(g == null)
                System.out.println(m.group(2));
            else
                System.out.println(s.substring(m.start() + 1, m.end() - 1));
}I'm still a bit new to regex ;) None of this is probably helpful to you if you don't have 1.4, but at least I'm having fun :D

Similar Messages

  • How can I maintain multiple white spaces in a PDF written from InDesign?

    I need to have 2 white spaces maintained (within a part #) in the PDF I write, but when I open in Acrobat it converts it to one space.
    I've tried word spaces, set spaces and applying "no color" to a placeholder character and nothing is working!
    Any ideas or suggestions?

    I am talking about normal white space. Multiple fixed widt spaces are not a problem. How the space is handled in a PDF depends on how it is created.
    Viele Grüße
    Wilhelm Georg Adelberger
    Von meinem iPhone gesendet
    Am 21.08.2014 um 12:01 schrieb Peter Spier <[email protected]>:
    How can I maintain multiple white spaces in a PDF written from InDesign?
    created by Peter Spier in InDesign - View the full discussion
    It may not be a great idea to use multiple spaces, but it certainly is not prohibited and sometimes is necessary -- you might want a 2em space, or a thin space before and after a tab you underline in a form.
    I'm able to select the multiple spaces just fine in Acrobat 9 using the text touch-up tool.
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at https://forums.adobe.com/message/6661037#6661037
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
    To unsubscribe from this thread, please visit the message page at . In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in InDesign by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • 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 can i remove white space between pics in picture package

    i am using ps elements 3 and want to use picture package to set up and print multiple passport photos on a single page.  passport photos must be 2"x2".  When I import or select a photo taken with my photobooth app on my mac and select custom size, i get 20 images on a page.  however, there is a white space of 1/2 inch around each image and the images are 1.5 " square rather than 2" square.  How do i get rid of the white margins around the images so that they will come out to be 2x2?

    The easiest answer would be to just get a Friskars cutter or something similar. I have one like this that I use to cut my photos apart. I found mine at a Walmart in either the scrapbook aisle or the hobby aisle.
    However, if you are determined to make a custom picture package you can try making a custom layout with a text editor. I know you can control the white space amount but not sure if you can totally eliminate it.
    A simple text editor will work...notepad works for this on Windows...not sure what is comparable on the mac.
    In PSE3, the layouts are found following this path Adobe<Photoshop Elements 3.0<Shared Assets<Layouts...note there is also a folder titled Layouts readmes which shows the formula to edit the layouts.
    Here is a link that details how to create a picture package layout using a text editor:
    http://www.graficalicus.com/index.php?name=News&file=article&sid=8&theme=Printer
    Caution: Make sure you save your custom layout with a new name so you don't overwrite the ones that ship with elements.

  • How to remove the white space of oam file?

    I have done the oam in Adobe Edge Animate, when i insert it into Adobe Dreamweaver,
    it turn into this:
    There is a white space under the oam file.
    How to get rid of it??
    I'm a design student without any much of knowledge of coding >< Please help me.

    When you insert the oam file, I assume it gets inserted as <object> tag.
         <object height="X" width="Y" ....  style="display:block"   ... ></object>
    Add the bold text to the object tag as shown above.
    hth,
    Vivekuma

  • Java delimiter for multiple white space

    Hi
    Is there a delimiter for multiple spaces? Or is there a simple way to check for more than one space and then replace them with a single white space or another delimiter?
    Thanks
    Brian
    Edited by: borratt on Apr 2, 2008 5:18 AM

    borratt wrote:
    So StringTokenizer should not be used at all anymore?
    Basically I am reading in a file which is separated by spaces, but some of the names have a space in it.
    I can split most of it fine due to the numerical only value at the beginning and the bracket etc.
    1 john frank                              football (89)          456
    tennis (76)             59
    19 dennis the mennis                      cricket (83)           678
    rugby (123)            567
    It is not obvious to me what you are trying to do though if you are trying to split a line at points of more than one space then you just needString[] splitLine = line.split(" {2,}");

  • 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

  • Preview: How get rid of white space above/below screenshots?

    My objective is to be able to make a composite screenshot by opening several and arranging their images on top of each other without unnecessary white space at the bottom and top of each of the pictures.
    I did not have such top and bottom white space when I used Preview with Leopard 10.5.8 on an old G5, only now with Lion on a mid-2011 iMac.
    Your counsel, please?
    Respectfully, Norm

    When the white space artifact appeared above and below each screenshot even before pasting into a composite, I thought it might be corruption of a preference but trashing of the 4 Preview plist files in Users/me/Library/Preferences did not fix it. 
    Your thoughts, please?

  • How to display trailing white space in spark label?

    I have to display trailing white spaces in spark label but its automatically truncating it.
    Any alternate way? Thanks!

    Thanks for the reply. But still not working

  • How do I remove white space on top of panelTabbed

    I have a menu bar on top of a panelTabbed. I would like no gap between the the content inside of the panelTabbed and the menu bar.
    Even if I set the tabs to below I still have a gap.
    Any ideas?
    Thanks
    justin

    Hi,
    skinning could help. For this you can use Firebug to identify the area and the skin selector that makes up the gap. See to learn about skinning and how to debug it: http://download.oracle.com/otn_hosted_doc/jdeveloper/11gdemos/adf-insider-skinning/adf-insider-skinning.html
    Frank

  • How to find out White Space

    Hi,
    I want to read the string between whitespaces. How to find out whitespace in the given string using java.
    Thanks,

    sabre150 wrote:
    I know I shouldn't be but I'm always surprised when people re-invent the wheel and implement a 6 line solution when a 1 line solution is available. And even though I shouldn't be, I'm still surprised when they say, "I tried but it didn't work," without any indication of what exactly they tried or how exactly it didn't work. Even after all this time, it still truly baffles me.

  • White Space After Form

    I have a Salesforce form embeded into two pages on my website.  Both pages have extra white space at the bottom and I can't decrease the height of the embedded HTML form in order to bring the footer up.  Both forms can be found here: http://www.beck-technology.com/form.html and http://www.beck-technology.com/student_form.html.
    Any ideas on how to decrease the white space?

    Hello,
    If you have removed the fields from the form, then you need to go to another state of the form and re-place the status message as well, to be able to shrink the form's frame. More details can be found here: http://forums.adobe.com/message/5240984#5240984
    Cheers
    Parikshit

  • InDesign 2.0: White Space Around Pages Disappeared

    I'm having a really frustrating issue with a document I've been creating in the same way for years. I usually use the whitespace around the pages in InDesign 2.0 to work on my graphics, but this morning I accidentally hit some mysterious shortcut that made the white space (and all my graphics) disappear (the are is now grey) I've been searching and searching the help section and the internet for a solution, but I'm stumped and running way behind on this project. Anyone know how to get that white space back? Thanks.

    Look at the last tool in the toolbox. This toggles between normal mode viewing the pasteboard, guides and other stuff,
    and the preview mode. As Dave says, the keyboard shortcut into and out of preview (which you obviously hit) is W, but if
    you use the toolbox button you will also be able to select a preview showing the bleed area and slug area as well.
    k

  • Detecting multiple touches in beta 5

    I was using the example found in coding how tos for how to detect multiple touches which went something like this:
    - (void)touchesChangedWithEvent:(UIEvent*)event
    NSSet *touches = [event allTouches];
    if (touches.count > 1)
    // have multiple touches
    So now they removed this method so i switched my touch detection to use:
    - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
    I was expecting touches.count to show me how many touches there are but this always seems to equal 1. Am I missing something or is it a simulator bug, or sdk bug?

    Well now I just feel dumb. Thanks for the quick response.

  • Scanning a line and skipping white space

    Hi,
    Yea I need to scan I line which I already have, but how do I skip white space or turn that scanned line into one without white space in it,
    I saw trim but doesn't that only take it off the begining and the end of the String?
    Is there an easy why to either scan it skipping white space or get that scanned line into one without white space in it?
    Thanks

    One way is to use StringTokenizer with " \t\n\r" as the separator string.
    StringTokenizer    tkzr = new StringTokenizer(str, " \t\r\n");
    StringBuffer       result;
    while (tkzr.hasMoreTokens()) {
        String    tkn = tkzr.nextToken();
        result.append(tkn);
    String             answer = result.toString();

Maybe you are looking for

  • Multiple iTunes accounts on a single iMac

    To start off with it really irritates me that I have to ask this question on a forum because Apple's support documentation is scattered and hidden and APPLE would rather charge support fees as if they already dont have enough freakin money! My questi

  • Getting Error in MIRO

    Hi Gurus, I am Doing 3rd Party Scenarion in IDES system on 4.6C ,when i tried to MIRO based on PO, system gives the following Error, For Object RF_BELEG (COMPANY CODE XXXX),number Range intervals 51 does not exit. Diagnosis. The Database table NRIV h

  • How to export documents of KM!

    HI You know there are many documents and files in KM. But I want move them  to a new KM Sever . So it's a big Problem  to me . I can export some configuration. but I wonder how to export the folder's content in KM. Please throw some lights on this!!

  • Recently purchased the movie Wolverine in HD but i cant play it on my ipad for more than ten seconds without it stopping. Can someone explain what can i do.

    Im having trouble watching a movie on my ipad and it wont play on my computer because its not HD. My ipod wont take the new movie into its drive whne i try to sync it. Is there something Im not doing.

  • Lens correction and DNG

    I have upgraded from Ltroom 3 to 5.2 and lots of differences straight away. I have a question if 1) enable profile corrections 2) setup is Auto or Custom Or Default 3) the camera is correcr ( canon) 4) Model of the lens is correct EF17-40 5) Profile