How do I find one string inside another?

I've been looking through the documentation, but have yet to find what I need. While I keep looking, maybe someone here has a good idea...
I have a TreeSet of Strings ts = { "foo", "bar", "green car" }, and another String s = "this is my new green car". I need to identify which Strings from ts are present inside s.
Current idea:
String s = "this is my new green car";
boolean bFoundOne = false;
Iterator iter = ts.iterator();
while(iter.hasNext() && !bFoundOne)
bFoundOne = Contains(s, iter.next());
boolean Contains(String sMaster, sCompare)
// what goes here???

Ah, yes! That's it! It would have to be something so simple... I was reading about java.text.collate and things like this. ;)

Similar Messages

  • How to find a string inside another String variable

    Hi,
    I need to find whether a string is available in a String of varying length.
    i.e., i want to know string "access" is available in a String variable( may have values like "microsoft access 2000 bla bla bla .." or "bla bla access microsoft").
    so, i dont know the starting point of the word 'access' in the String variable.
    Pls help me in doing this.
    Thanks in advance,
    Rao

    Check the API documentation for this method:
    "int indexOf(String str)
    Returns the index within this string of the first occurrence of the specified substring."

  • How can i use one dtd inside another dtd

    Hello friends,
    I have read some where that one DTD can be imported into another DTD but idont remember how to do it.
    My question is suppose we have a DTD say xyz.dtd and i am writing a new DTD say abc.dtd, and lets assume that in abc.dtd i have to declare some of the elements of xyz.dtd, so iwant to import xyz.dtd into abc.dtd.
    Can anybody please give me a solution for this.
    Thank you,
    sridhar.

    something similar to this.
    // This is abc.dtd
    <!ELEMENT MESSAGE_NODE (MSGHEADER, MESSAGEBODY)>
    // Include the DTD for the Message Header
    <!ENTITY % MSGHEADER SYSTEM "xyz.dtd">
    %MSGHEADER;

  • How to find a string inside Excel table

    Hi,
    I am trying to find a string inside Excel table, and it does not work. Please see attached figure. I use the find Invoke Node and do not get anthing.
    Please help
    Attachments:
    find_excel.JPG ‏21 KB

    See attached files.
    Thanks,
    David
    Attachments:
    Excel_table.xls ‏15 KB
    Read_XL.vi ‏42 KB

  • How do I reference an EJB inside anothe EJB ,both are on different hosts

    Hi,
    I want to reference an EJB on one host inside another EJB in another
    host. Even if i hardcode the url of the host on which the EJB is
    deployed , it gives me the error regarding the no such ejb found.
    I would appreciate your help.
    Thanks

    Robert,
    We've been trying to implement this type of multi-server setup for some
    time now. Our application consists of 260+ EJBs with a large team of
    developers actively working against it. The business logic in our
    application puts the EJBS in a highly interrelated situation. This
    degree of interrelation makes it necessary for each developer to deploy
    the entire application before any work can get done.
    Starting a weblogic server, on a Windows Workstation, with 260+ beans is
    very time consuming. But to get around this development bottle neck, we
    are attempting the same scenario described in this thread. We have
    recently upgraded from WL4.5.x to WL5.1 SP8. With WL5.1, we get the
    CommunicationException seen previously in this thread. But the Error
    message in WL5.1 is less descriptive. The 5.1 error message is missing:
    WL6.0 Error Text: "This error could indicate that a component was
    deployed on a cluster member but not other members of that cluster. Make
    sure that any component deployed on a server that is part of a cluster
    is also deployed on all other members"
    It is obvious that weblogic's clustering depends on classes being
    available to each server in the cluster, including the ejbc generated
    _WLStub classes.  To me, it seems wrong that a weblogic server can only
    use standard JNDI to lookup HomeInterfaces on other weblogic servers if
    the hidden _WLStub classes are available to both servers.  I say this
    because non-weblogic clients have JNDI lookup abilities without these
    requirements. This whole experience was frustrating because all along
    I knew that the solution was simply to take the hacker route and put the
    classes in the the client classpath. I guess I just want to know if
    this is bug? If not, I think it should be.
    Thanks for listening
    Steve Dodge
    Steve Dodge
    Realeum Inc.
    Robert Patrick wrote:
    Here is an example:
    On server1, I have a Bean called TellerBean that calls the AccountBean
    that lives on server2. To make this work, I need to deploy the
    TellerBean.jar file AND any/all AccountBean Stub classes (any file in the
    deployed version of the AccountBean.jar file matching the pattern
    AccountBean*Stub.class) on server1. Server2 only needs to deploy the
    AccountBean.jar file
    Hope this helps,
    Robert
    kamps wrote:
    Thanks.
    I did include the files using import and they are alsso packaged
    into the jar file .
    I have done this , TradeCheck is the ejb i am trying to reference
    in Trader EJB.
    I package them into the jar file as follows:-
    @REM Compile EJB classes into the build directory (jar preparation)
    javac -d build TradeCheck.java TradeCheckHome.java Trader.java
    TraderHome.java TraderBean.java TradeResult.java
    @REM Make a EJB jar file, including XML deployment descriptors
    cd build
    jar cv0f std_ejb20_basic_statelessSession2.jar META-INF examples
    images
    cd ..
    @REM Run EJBC on jar file
    java -classpath
    %WL_HOME%/lib/weblogic_sp.jar;%WL_HOME%/lib/weblogic.jar weblogic.ejbc
    -compiler javac build\std_ejb20_basic_statelessSession2.jar
    %APPLICATIONS%\ejb20_basic_statelessSession2.jar
    It still gives the same error not finding the stub class.... Could
    you kindly elaborate on what needs to be done.
    I would appreciate your help.
    Thanks,
    Sunitha
    Robert Patrick <[email protected]> wrote:
    The problem is that the client that downloads the stubs
    at runtime cannot
    be another WebLogic Server. We do not support downloading
    classes into a
    running server so you will need to make sure that the
    stubs are
    "available" to the server that is acting as a client (e.g.,
    packaged in
    the EAR file) on the server acting as a client.
    kamps wrote:
    Thanks Mahendra. I am using WebLogic 6.0. Should I importthe package
    in the first ejb which references the 2nd ejb or evenin the client
    which references the first ejb.
    Thanks again,
    Sunitha
    "Mahendra Dhamdhere" <[email protected]> wrote:
    You are not getting the reference of stub.
    try this. In your client program, import the package
    in
    which ejb classes
    are present. As client downloads the stub from weblogic,
    you have to import
    the package where your stubs are present.
    which version of weblogic are you using?
    Mahendra
    kamps <[email protected]> wrote in message
    news:[email protected]...
    Thanks,
    I have 2 ejbs: one is TraderBean and a client RefClient.
    TraderBean in turn calls a method of another bean
    TradeCheckBean.
    I tried making the changes as suggested but I amgetting
    the following
    error on the client side.
    java examples.ejb20.basic.tatelessSession.RefClient"t3://localhost:7001"
    javax.naming.CommunicationException. Root exceptionis
    java.rmi.UnmarshalException:
    failed to unmarshal class java.lang.Object; nested
    exception
    is:
    java.lang.ClassNotFoundException:examples.ejb20.basic.statelessSession.Trade
    CheckBeanHomeImpl_WLStub: This error could indicatethat a component
    was deployed on
    a cluster member but not other members of that
    cluster.
    Make
    sure that any componen
    t deployed on a server that is part of a cluster
    is
    also deployed
    on all other member
    s of that cluster
    java.lang.ClassNotFoundException:examples.ejb20.basic.statelessSession.TradeCheckBea
    nHomeImpl_WLStub: This error could indicate that
    a
    component was
    deployed on a clus
    ter member but not other members of that cluster.
    Make
    sure that
    any component deploy
    ed on a server that is part of a cluster is also
    deployed
    on all
    other members of tha
    t cluster
    <<no stack trace available>>
    I would appreciate any help.
    Thanks,
    kamps
    "Mahendra Dhamdhere" <[email protected]> wrote:
    you need to get initialcontext of that server.
    Context ctx = null;
    Hashtable ht = new Hashtable();
    ht.put(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
    try
    ctx = new InitialContext(ht); // Use
    the
    context
    in your program
    } catch (NamingException e)
    {    // a failure occurred  }
    finally {    try {ctx.close();}
    catch (Exception e)
    {      // a failure occurred    } }
    use url of that other server. After getting initialcontext,
    lookup for your
    ejb.
    Mahendra
    kampu S <[email protected]> wrote in message
    news:[email protected]...
    Hi,
    I want to reference an EJB on one host inside
    another
    EJB in another
    host. Even if i hardcode the url of the host on
    which
    the EJB is
    deployed , it gives me the error regarding the
    no
    such
    ejb found.
    I would appreciate your help.
    Thanks

  • How do I swap one clip for another in Final Cut Pro 7?

    How do I sway one clip for another in Final Cut Pro 7? I am doing what it says in a book but it is not working. Thanks.

    You drag the clip from the browser to the clip on the timeline. Wait till the timeline clip goes white. Drop it and pick from the menu that appears the replace option you want.

  • My slide presentation (with sound) is done. How can I change one song from another?

    My slide presentation (with songs) is done. How can I change one song from another?

    Do you still have your Aperture Slideshow project? Then open the slideshow and select the one of the green audio file clips in the film strip that you want to replace. Press the "delete" key and drag another audio file from the Media Browser directly onto the slide, where the sound should start.

  • HT3529 How do I disconnect one iphone from another iphone's iMessage?

    How do I disconnect one iphone from another iphone's iMessage?

    He needs to get his own Apple ID.
    Have him logout from your Apple ID at settings>>iCloud .
    He should then set up his own Apple ID.

  • How do I copy one image onto another image?

    How do I copy one image onto another image?

    Lots of ways;  Use the Place command to place a file in another.  Open two files and drag one to the other's window tab, drag an image from bridge onto an open file.  Open an image, press ctrl/cmd-A to select all, the ctrl/com-C to copy the image, the ctrl/cmd-V to paste it into another image.

  • How to integration between one model to another model

    hi friends
    can any one explain me
    how to integration between one model to another model 
    ex:- i have sales model 1 and  i have anther model finance model how to changes  in figures in sales model as well same change are happen in finance model how it possibly please explain me friends   
    and how many ways i can do this ?
    Thank you
    suresh m

    Hi Suresh,
    If you do changes in Finance and want to send data in Sales , you can use LOOKUP /DESTIANTION_APP -script logic or ABAP logic.
    To have seamless flow, you need to take care of security.
    Explain your requirement in  more detail .
    May be helpful .
    Shrikant

  • HOW TO MOVE FROM ONE JSP TO ANOTHER BY HIDING URL CHANGES

    HOW TO MOVE FROM ONE JSP TO ANOTHER BY HIDING URL CHANGES IN AN ADDRESS BAR

    Please check before posting that you have not accidentally turned on the CAPS LOCK feature of your keyboard.
    To answer your question. You can't do that. There are alterate ways to solve this sort of problem. What exactly is the nature of the problem you are seeking to solve?

  • How to skip from one list to another list in interactive report?

    Hi Friends,
    How to skip from one list to another list in interactive report that means now i am in 7 th list how to skip 4th list ?
    Or  now i am in 7 th list how to skip 9th list ?
    can anybody send sample code please.
    Thanks in advance.

    hi,
    at line-selection.
    case sy-lsind.
    when 9.
    sylsind = 4.
    endcase.
    try like this when u r in 9th list next it goes to 4 th list

  • How GroupArt remove from one layer to another.

    hi all,
    How GroupArt move from one layer to another.
    Thanks in advance.

    Hi Vijay,
    1) To add new events you have to define a custom action, e.g. under the settings of a button you can choose custom action and define a name for this action
    2) You have to add a custom action, e.g. "next" then you must connect the two layers (drag a line from one layer to the other) and change the event name into "next"
    3) you can pass data from one layer to another like you do it from a form into a rfc/query and so on
    There is also a tutorila available in the help:
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/04/80aab03df044ec995000842e77e1be/frameset.htm">http://help.sap.com/saphelp_nw2004s/helpdata/en/04/80aab03df044ec995000842e77e1be/frameset.htm</a>
    The bank example shows you how to use layers as a wizzard.
    Best Regards,
    Marcel

  • HT4528 How do I find one of my phones?

    How do I find one of my Phones... I have been rying for 1 hour and no support.

    login to icloud.com and use Find my iPhone.  If you didn't set it up prior to losing it, then it's gone.

  • How do i insert one string to more then one textField?

    how do i insert one string to more then one textField?

    var myString = "My String";
    myTextField1.text = myString;
    myTextField2.text = myString;
    myTextField3.text = myString;
    myTextField4.text = myString;
    // etc...

Maybe you are looking for

  • Need help with drop down list in parameters

    Hi All, I have the following data set: DEPT1     DEPT2     DEPT3 DEPT4 Commissioner's Office     Finance     Accounting     Accounts Payable Commissioner's Office     Finance     Accounting     Fiscal Analysis & Repo Commissioner's Office     Finance

  • I movie wont export????

    I have a brand new mac book pro when I try to export a video my export option is not available??? Do I have to register I life ?any help please

  • Display Same Report Twice in a Page

    Hi I have a report whose size is (hight 5.5 inch, width 8 inch). I want to print the report twice in a paper. The paper size is (hight 11 inch, width 8 inch). I am in the platform of Oracle developer 2000. Please say me what should I do? Farhad

  • What happened to my registration?

    i installed the latest Photoshop Extended CS6 and completed registration, this all worked well for a few days now my product registration has disappeared from my account. I have tried going through the help sysyem and get to the 'register my product'

  • MAX 4.2.1 Error?

    Hi! Upon LV 8.2.1 (along with RT & FPGA modules) setup, when "Software" in "My System" is clicked, MAXplorer just spit out the following Message (see attachments)! Suggestions, comments ... ...and Thanx in advance! Attachments: Message.JPG ‏20 KB