Need a method!

Hi, Does any body know of a method i can use to test if a String contains a space or possibly anything else for that matter.
I dont want a boolean return but maybe a -1 for no spaces. It will be used in an if statement as shown
if(line.charAt(0)==' '&&line.substring(1) // has spaces   )
    word=line.substring(1, line.indexOf(' ', 1));
  }

amitbob21 wrote:
... a method i can use to test if a String contains a space
maybe a -1 for no spacesYou are already using it; [String.indexOf()|http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#indexOf(int,%20int)]
or possibly anything else[String.matches()|http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#matches(java.lang.String)]

Similar Messages

  • The pdfs that are produce in Word are very large. I need a method of compressing them variably - not just a quick reduction using the quartz filter.  Is their a suitable free compression programme,

    The pdfs that I produce in Word are very large. I need a method of compressing them variably - not just a quick reduction using the quartz filter.  Is their a suitable free compression programme,

    PDF Shrink for Mac
    Compress PDF – Reduce your PDF Online
    PdfCompress for Mac

  • I need a method to target specific columns in an IP query embedded in a WAD

    I have an IP enabled WAD with multiple embedded queries.  I need a method to target specific columns of specific queries so as to enable text wrapping.  Does anyone have a technique that has worked for them that they can share?
    Sheldon

    Hi Mayank -  I would think some JavaScript code might work, but I would be open to any technique that works.

  • I need a method for ignoring empty lines

    Hi to all,
    i need a method for ignoring empty lines when my program reades a file like that
    start of file
    print "xoxox"
    //ignore this line
    println"xaxaxa"
    //ignore this line
    end of file
    cheers

    Are you having trouble detecting these empty lines? Or are you having trouble not processing them once you've detected them?
    For the first case, you neeed to define "empty." I assumed it meant "containing no characters," and that's what the first solution shows. Your example looks like "empty" means "starts with comment characters."
    For the second case, you ignore them by just not doing anything: read a line
    if (it is not empty) { // by whatever criteria you define for "empty"
       do something with it
    }

  • I need badi method for

    hi
    when i enter a material quantity in pr and if it is not match with material quantity with po order i should get a error message.
    i need badi method for this with explonation.

    hi,
    BADI and BAPI
    hope this helps u,
    Arunsri

  • Help realllllllllllllllllllllllllly needed - rectangle methods ... please

    k i know this is going to be alot but i feel like i need to post all the details of the assignment for it to be easier for people to understand. the length of this is probably going to deter some people but hopefully some nice people will take the challenge lol...its beginners stuff for AP:
    1. A default Rectangle object is specified in the constructor with the x, y, and width and height set to 0.
    2. A Rectangle object is specified in the constructor with the left and right edges of the rectangle at x and x + width. The top and bottom edges are at y and y + height.
    3. A Rectangle object is specified that is a copy of an existing Rectangle.
    4. Methods getXPos( ), getYPos( ), getWidth( ), and getHeight( ) return the x, y, and height and width of the Rectangle, respectively.
    5. A method getDirection( ) returns the current orientation of the DrawingTool.
    6. Methods setXPos( ), setYPos( ), setWidth( ), and setHeight( ) set the x, y, and height and width of the Rectangle respectively to the value of each method?s double parameter.
    7. A method setDirection( ) sets the current orientation of the DrawingTool.
    8. A method getPerimeter( ) calculates and returns the perimeter of the Rectangle.
    9. A method getArea( ) calculates and returns the area of the Rectangle.
    10. A method draw( ) displays a new instance of a Rectangle object.
    11. A method drawString( ) displays String at the specified x and y coordinates of the drawing area.
    # The methods draw( ), drawString( ), and setDirection( ) make use of existing DrawingTool methods. Refer to the DrawingTool specifications that you printed out in week two for details on DrawingTools methods.
    # Write a testing class with a main method that constructs a Rectangle, rectA, and calls setDirection( ), setWidth( ), and draw( ) for each Rectangle created. It is recommended that the changes in orientation and width of each successive rectangle in the spiral be calculated using the getDirection( ) and getWidth( ) methods. For example, if the increment for each turn is given by turnInc and the decrease in size of the rectangle is given by widthDec, then successive calls to the following:
    rectA.setDirection (rectA.getDirection() - turnInc);
    rectA.setWidth (rectA.getWidth() - widthDec);
    rectA.draw ( );
    would draw each ?spoke? of the rectangular spiral.
    # Construct another Rectangle , rectB, that is a copy of the original rectA. Draw the rectangle in the upper left corner of the drawing area. Label the width, height, perimeter, and area of the rectangle. The resulting image will be similar to the one shown below:
    so far this is wat i have: class Rectangle
        private static DrawingTool pen = new DrawingTool(new SketchPad (500,500));
        private double myX;      
        private double myY;        
        private double myWidth;
        private double myHeight;
        private double perimeter;
        private double area;
        private double myDirection;
        //Default constructor
        Rectangle()
        Rectangle(double x, double y, double width, double height)
            myX = x;
            myY = y;
            myWidth = width;
            myHeight = height;
        Rectangle (Rectangle rect)
        public double getPerimeter()
            return 2 * (myWidth + myHeight);
        public double getArea()
            return myWidth * myHeight;
        public void draw()
            pen.up();
            pen.move(myX, myY);
            pen.down();
            pen.setDirection(90);
            pen.forward(myHeight);
            pen.turnRight(90);
            pen.forward(myWidth);
            pen.turnRight(90);
            pen.forward(myHeight);
            pen.turnRight(90);
            pen.forward(myWidth);         
        public void drawString (String str, double x, double y)
            myX = x;
            myY = y;
        public double getXPos ()
            return myX;
        public double getYPos ( )
            return myY;
        public double getWidth()
            return myWidth;
        public double getHeight()
            return myHeight;
        public double getDirection()
            return myDirection;
        public void setXPos(double x)
            myX = x;
        public void setYPos(double y)
            myY = y;
        public void setWidth(double width)
            myWidth = width;
        public void setHeight(double height)
            myHeight = height;
        public void setDirection(double distance)
            distance = myDirection;
    public class RectangleTest
        public static void main(String[] args)
            Rectangle rectA = new Rectangle();
            rectA.setDirection (rectA.getDirection() - turnInc);
            rectA.setWidth (rectA.getWidth() - widthDec);
            rectA.draw ( );//not sure how to use this set of code, was given to me.
    }any input always appreciated =)

    getDirection() is supposed to get the pen's direction. At the moment you are
    setting and getting your own value (myDirection) that has nothing to do with
    the pen.
    So I would write something like:public double getDirection()
        return pen.getDirection(); // <-- or something...
    }You will have to consult the DrawingTool's documentation to find out exactly what
    pen method you are after. setDirection() will be similar.
    (Notice - by the way - what you are doing here: when someone creates a
    Rectangle you are sort of "hiding" the drawing pen from them. You are letting
    them see and change the direction of the DrawingTool but nothing else
    like colour or thickness or whatever else a DrawingTool has.)
    You have to do two things - perhaps even before you change the
    get/setDirection() methods:
    (1) Write something in main() that will test what you've done so far.
    Ie use the setXXX() methods to set the width, height, position etc. Check
    that the getXXX() methods are returning the right values.
    Your tests will tell you if you're on the right track.
    If your code won't compile (and you can't figure out the compiler's message!)
    then you have a specific question to ask. Remember to say what the
    message is, and indicate what line it refers to.
    If your program compiles, but you get really weird and unexpected results -
    like is says a test Rectangle has an area of -42 - then, again you will have a
    specific question.
    (2) Go through the specifications carefully, and figure out which constructors
    and methods you have not implemented. If the meaning of the
    specifications are truely incomprehensible to you, you again have something
    specific to ask.
    Good luck.

  • Need replacement method for FM: REUSE_ALV_GRID_DISPLAY.

    Hi
    i need a replacement method for FM: REUSE_ALV_GRID_DISPLAY from the class CL_GUI_ALV_GRID,
    kindly let me know if someone knows the solution for it.
    regards
    mano

    Method set_table_for_first_display, look at [ALV Grid Control (BC-SRV-ALV)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf]
    Regards

  • LMS3.2 - Need Customized method for cofig archive to particular device.

    Hi all,
        We are using Cisco works LMS 3.2 - Added around 400 devices and monitoring the same.  Facing a issue like while taking a configuration backup getting all devcie details and also CONFIG_ARCHIEVE Job is time consuming, because getting all device configurations. To avoid this we need to know the customized method to archive target particular device configuration in the LMS 3.2 .
    Can any one help on this...Thanks in advance.
    Thanks and Regards
    Ramprakash

    This is possible. You can schedule a Archive job for perticular devices to run periodically, like every 6 hours, daily, weekly or monthly.
    This can be done from :
    RME > Config Mgmt > Archive Mgmt > Sync Archive
    -Thanks
    Vinod

  • Need class method example for updating infoype15

    Hi All,
    I need to update infotype 15 without using BDC and HR_INFOTYPE_OPERATION function module, i have suggexted to use Class methods please can any one help in this regards with sample code of updation of infotype with class methods,
    Regards,
    Reddy

    Hi
    You can use the following interface:
    IF_HRPA_PLAIN_INFOTYPE_ACCESS - HR: Writing Infotype Records
    Interface for Writing Infotypes
    This interface permits simplified write accesses for infotypes. In particular, such accesses function for "simple" infotypes only. By definition, all infotypes that use CL_HRPA_INFOTYPE_CONTAINER as container class are simple. All other infotypes cannot be processed or can only be processed in a basic way using this interface.
    Regards

  • Need a method for importing Palm III data into a Palm Centro

    I just bought a Palm Centro (Verizon), with the expectation of importing data from my old Palm III.  From the Palm III Desktop, I exported Contacts, Calendar, Tasks, and Memos into separate folders (this was done on a Windows XP PC) and copied the resulting folders & files onto a flash drive.  But when I try to import these files into the Palm Centro desktop (on a new Mac Pro with OSX), the backup files are not in a "recognized format."  Does anyone have a process for reliably getting the Palm III data into the Palm Centro?  Also, is there an easy way to purge unwanted Contacts/Calendar events from the Palm Centro handheld?  With all the trial and error, its accumulating a lot of garbage.  Thanks...
    Post relates to: Centro (Verizon)

    Click on the following link for the upgrade guide on kb.palm.com
    http://www.palm.com/cgi-bin/cso_kbURL.cgi?ID=12926
    You will need to hard reset the Centro in order to clear out the Centro before sync'ing. Click on the following link for the hard reset procedure.
    http://www.palm.com/cgi-bin/cso_kbURL.cgi?ID=887
    Click on the following link for the support page for your devices on the kb.palm.com webpage.
    http://www.palm.com/us/support/centro/centro_vzw/
    http://www.palm.com/us/support/palm3/
    There are links on the pages to the user guide, troubleshooting, how to's, downloads, etc.
    You could try to export the data in each category in Palm desktop, save to the flash drive and import the data.
    Click here for the data export procedure.
    http://www.palm.com/cgi-bin/cso_kbURL.cgi?ID=36288
    Make sure you select "ALL" for the range during the export procedure. If you don't, it will only export the currently selected record.
    Post relates to: Palm i705

  • Your help needed: sychronized method behaving wrong

    //sychronized method behaving wrong:
    /*expected synchronized output:
    Thread-x: begin
    Thread-x: end
    Thread-y: begin
    Thread-y: end
    /*actual un-synchronized output:
    Thread-x: begin
    Thread-y: begin
    Thread-x: end
    Thread-y: end
    //what's wrong with the following code snippet about sychronized method? Thx!
    class Test implements Runnable {
         public void run() {
                   doo();          
         private synchronized void doo() {
              System.out.println(Thread.currentThread().getName() + ": begin");
              try { Thread.sleep(new java.util.Random().nextInt(10));} catch (Exception e) {}
              System.out.println(Thread.currentThread().getName() + ": end");     
         public static void main(String[] args) {
              Test[] tests = new Test[10];
              Thread[] tt = new Thread[10];
              for (Test test:tests) new Thread(new Test()).start();
    }

    oops! changing the thread initialization has sloved the problem, cauz synchronized method applies to the same object executing multiple threads.
    ...main...{
    Test t = new Test();
    for (int i=0;i<10;i++) new Thread(t).start();
    }

  • Oracle Web Forms - need a method to get data from a Form to Excel

    I am running Oracle Forms 6i for the web.
    I need a way of using the old DDE or OLE implmentation to get
    data to an Excel spreadsheet. Ideally opening an existing
    spreadsheet and inserting new data.
    Anyone been able to do this ?
    Thanks in advance
    Dave.

    If you have EXcel on your application server (the one where forms
    is), you can still use OLE2 calls to create or modify the excel
    sheet on the server. Then you can use web.show_document to get
    the excel file back to the client machine.

  • Need blocking method without blocking main thread

    I have this problem:
    public void blockingMethod() {
      frame.setVisible(true);
      // wait for the user to click on a button on the frame
      return;
    }I want to make a method blocking until the user press a button on the frame. However, I can't make the current thread sleep or wait and then notify it when the button is pressed, because it is the main thread that calls this method. And the main thread is responsible for listening to events and repaint the frame.
    I could solve my problem by using a modal Dialog and let the user enter some data there and then exit the Dialog. Dialog.show() would block until the user exits it again. But I would rather use my frame, so I took a look at the code for Dialog.show() method, and it does something like this:
    EventDispatchThread dispatchThread =(EventDispatchThread)Thread.currentThread();
    * pump events, filter out input events for
    * component not belong to our modal dialog.
    * we already disabled other components in native code
    * but because the event is posted from a different
    * thread so it's possible that there are some events
    * for other component already posted in the queue
    * before we decide do modal show. 
    dispatchThread.pumpEventsForHierarchy(new Conditional() {
      public boolean evaluate() {
        return keepBlocking && windowClosingException == null;
    }, this);But EventDispatchThread is package protected, so I can't do this.
    Any suggestions? I think there are circumstances where you would like a method block, but where it is the main thread that calls the method (out of my control), and you would not like the main thread block unless you could make sure the gui would still repaint and events would run.

    Ah, nm. The main thread is not the same as the event thread.
    Whew! :)
    The first who reply will get the dukes.

  • Need a method to trigger the creation of COMPLAINT

    Hello All,
    I would like to create a return order (Complaint document) from the service order automatically using an action. I can create a new action and schedule the start condition for which the action should be triggered.
    But my doubt is which method should I use in the 'METHOD CALL" I could see some methods like "COMPLETE_DOCUMENT' but these cannot be used to create a return order.
    Thanks in advance.
    Regards,
    Padma.

    Can anyone explain any of the following with an working example.vi  
     Prepend your signal with a copy of the signal from the previous acquisition.
    Or make a long enough stretch of a flat signal equal to the beginning of your signal and prepend it before sending it to the filter function.
    Or mirror your signal and prepend it to your signal.
    Then after filtering, ignore the first part that is the filtered part of your prepended signal.
    Thanks.

  • Need help - method call error cannot resolve symbol

    My code compiles fine but I continue to receive a method call error "cannot resolve symbol - variable superman" - can't figure out why. Here is my code:
    public static String caesar(String message, int shift)
    {   [b]String result = "";
    for(int i = 0; i < message.length(); ++i)
    {   [b]char newChar = message.charAt(i + shift);
    result += newChar;
    return result.toUpperCase();
    I entered "superman" for message and "3" for the shift. Can someone please help? Thanks!

    Your post worked great - especially since it made me realize I was going about it all wrong! I was attempting to convert "superman" to "vxshupdq" - basically a cipher shift starting at index 0 and shifting it 3 character values which would result in s changing to v. I restructured my code:
    public static String caesar(String message, int shift)
    {   [b]String result = "";
    for(int i = 0; i < message.length(); ++i)
    {   [b]char newChar = message.charAt(i);
    result += (newChar + shift) % message.length();
    return result.toUpperCase();
    But it's displaying the result as a "60305041". How can I get it to display the actual characters?

Maybe you are looking for

  • Unable to read configuration from NDS

    Dear All, I just finished setting up this Border 3.9 server few months ago, everything works fine; but from time to time I will get the following message during ACLCHECK as follow: For example this is a log from system console after I made some chang

  • Writing arrays to spreadsheet w/ timestamp

    Hi. I'm trying to build an application which will write a set of thermocouple values to a spreadsheet with a timestamp at the beginning of each row. What I have so far is a countdown loop which gives me regular intervals of time. When the loop reache

  • Problem with Software Distribution in LMS 3.2

    LMS 3.2 on Solaris 10 I'm trying to distribute IOS images via Software Mgmt. I'm getting the following error on step 2 - View Recommendations. "SWIM0087: Recommendation module timed out while waiting for the procedure to complete. Either the device h

  • Fully Qualified Domain Name for Portal Server on Win XP

    I'm trying to install the Portal Server (java_es_05Q1_portal-windows-x86) to a Win XP workstation to test my Kosmos portlets (http://labs.jboss.com/projects/kosmos). I get the following error msg after selecting the features: System doesn't have Full

  • Multicast Imaging--2 questions

    1) I'm deploying ZDM 6.5 to a very large school district. At one of my test sites, multicast imaging is turned on. Everything about the multicast session works as it should from the ZDM perspective. However, the session takes 70 minutes to complete t