String Compare

Hi,
I want to compare two strings,
String1 i read from a text file and string two can be a constant.
After comparing, if string from text file is matching to constant, need to do some processes.
Anybody please comment on this.
-mfp.
Solved!
Go to Solution.

Your question is extremely basic. PLEASE read the LabVIEW Help and do the tutorials. It's not a waste of time.
To learn more about LabVIEW it is recommended that you go through the tutorial(s) and look over the material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. You can also take the online courses for free.
Attachments:
Example_VI_BD.png ‏2 KB

Similar Messages

  • [svn] 1751: Bug: BLZ-174 - MessageClient.testMessage() is incorrectly doing a string compare for the subtopic header of an inbound message against the subtopic value (which may contain wildcards) that the Consumer is using.

    Revision: 1751
    Author: [email protected]
    Date: 2008-05-15 14:21:43 -0700 (Thu, 15 May 2008)
    Log Message:
    Bug: BLZ-174 - MessageClient.testMessage() is incorrectly doing a string compare for the subtopic header of an inbound message against the subtopic value (which may contain wildcards) that the Consumer is using.
    QA: No - customer verified the fix.
    Doc: No
    Ticket Links:
    http://bugs.adobe.com/jira/browse/BLZ-174
    Modified Paths:
    blazeds/branches/3.0.x/modules/core/src/java/flex/messaging/MessageClient.java
    blazeds/branches/3.0.x/modules/core/src/java/flex/messaging/services/MessageService.java

    If you create a metadatatype with a single metdata block, and you reference that in your vm/cm cell attribute using a *one* based index, Excel seems to see the link and it honors it when saving the spreadsheet.
    So, I ended up with something like:
    <c ... cm="1"/> (I'm dealing with cell metadata, but the concept is equivalente to value metadata)
    <metadataTypes count="1">
      <metadataType name="MyMetaType" .../>
    </metadataTypes>
    <futureMetadata count="1" name="MyMetaType">
      <bk>
        <extLst><ext
    uri="http://example" xmlns:x="http://example"><x:val>87</x:val></ext></extLst>
      </bk>
    </futureMetadata>
    <cellMetadata count="1">
      <bk><rc
    t="1" v="0"/></bk> <!-- this is what gets referenced as cm=1 on the cell -->
    </cellMetadata>
    Hope this helps. 

  • Using wildcards for String compare

    Hello,
    I want my prog to find out all Strings which start with the letters 'File'. How can I make a String compare by using wildcards ?
    Thanx,
    Findus

    You may use the String method startsWith to find strings beginning with File. eg. filename.startsWith("File")
    for more complicated comparisons you might want to use regular expressions.

  • Problems with string comparing

    I have a function, getPlayerName() that returns the contents of a text field, but i want the dialog box to check and see if there was anything typed in there, so i have done things like if(this.getPlayerName() != null), if(this.getPlayerName() != "") and if(this.getPlayerName() != " "), and the statement still lets it go by when i dont type anything in. is there something else i'm suppose to do?

    When comparing strings (and any other object for that matter) you must use the equals method. In your case you should probably also trim the string for whitespace before comparing:
    if(!this.getPlayerName().trim().equals("")) In this case you can also use the length method:
    if(this.getPlayerName().trim().length() != 0)

  • String comparator

    Hey guys,
    I am having a problem comparing 2 strings in an if statement.
    I have an NSString called picked and a string literal that I want to compare in the if statement. I want to see if those two strings are visually the same (meaning they both say "something" and that I am not trying to compare their addresses or anything.
    I have the following: if(self.picked == @"something") {...
    Of course I realize that "==" is probably comparing their memory addresses. However, when I try to use isEqualToString method, I either am using it wrong, or that method does not apply to this situation because I get errors/warnings.
    Thanks in advance for the help.

    I have the following: if(self.picked == @"something") {...
    I think this is in NSString
    if ([self.picked isEqualToString:@"something"]) {
    NSLog(@"Equal strings");
    Also I believe NSString subclasses NSObjects isEqual method so that it does the same thing so you could use
    if ([self.picked isEqualTo:@"something"]) {
    NSLog(@"Equal strings");

  • String compare problem

    I try to compare 2 strings with compareTo/equalTo, but it's not working, those 2 funcs always return ture.
    public boolean chMark(String name, String test, String newMark)
              boolean flag = false;
              for(int i = 0; i < course.getNumOfStd(); i++)
                   if(course.getStd().getName().compareTo(name)==0)//here is problem;
                        Student tempStd = course.getStd()[i];
                        for(int j = 0; j < tempStd.getMark().getNumOfTests(); j++)
                        if(tempStd.getMark().getTestArray()[j].getTitle().compareTo(test)==0);//here is problem;
                             int mark = Integer.parseInt(newMark);                    }
              return flag;
    Can anybody tell me why?
    REGARDS,
    Elton

    equals() would read more naturally than compareTo()==0. But, in
    either case, use System.out.println() to write the two strings before
    you compare them. This is to check that you are comparing what
    you think you're comparing.System.out.println("name from course is " + course.getStd().getName());
    System.out.println("name is " + name);
    if(course.getStd()[i].getName().compareTo(name)==0)//here is problem;
    System.out.println("name from couse and name compared equal");
    // etc

  • String compare using S .equals() and ==

    When comparing strings, what is the different between using stringx.equals(stringy) and stringx == stringy?
    And what is the different between threads that are created by implement Thread or extends Runnable.
    They both work fine in my application

    When comparing strings, what is the different between
    using stringx.equals(stringy) and stringx ==
    stringy?
    And what is the different between threads that are
    created by implement Thread or extends Runnable.
    They both work fine in my applicationactually the equals method has been overridden to String class so that it gives you true when ever two String object contains the same String value whether the == gives you true only when two objects are same. here I guess two objects are same so you are getting true in both cases.
    for the second answer it is generally depending upon your requirement to adopt one of the ways. Sometimes you are forced to implement runnable because you may have already Extends another class. Personally I felt its more often that we implements Runnable than extending the Thread class
    Message was edited by:
    tanmoy_rajguru
    Message was edited by:
    tanmoy_rajguru

  • String compare EL

    How to compare strings in ADF Expression Language?
    I am trying with the below to change background color dynamically. The string comparision does not seem to happen. What I am doing wrong?
    <af:selectOneChoice value="#{bindings.StatusFlag.inputValue}"
    label="#{bindings.StatusFlag.hints.label}"
    required="#{bindings.StatusFlag.hints.mandatory}"
    shortDesc="#{bindings.StatusFlag.hints.tooltip}"
    id="selectOneChoice1"
    inlineStyle="background-color:#{bindings.StatusFlag.inputValue eq 'Pending'?'green':'red'};">
    <f:selectItems value="#{bindings.StatusFlag.items}"
    id="selectItems1"/>
    </af:selectOneChoice>
    Thanks

    Hi,
    I guess you need to change contentStyle and used frank's suggetion
    try
    <af:selectOneChoice value="#{bindings.StatusFlag.inputValue}"
    label="#{bindings.StatusFlag.hints.label}"
    required="#{bindings.StatusFlag.hints.mandatory}"
    shortDesc="#{bindings.StatusFlag.hints.tooltip}"
    id="selectOneChoice1"
    contentStyle="#{bindings.StatusFlag.inputValue eq 'Pending'? 'background-color:green' : 'background-color:red'};">
    <f:selectItems value="#{bindings.StatusFlag.items}"
    id="selectItems1"/>
    </af:selectOneChoice>-Suresh

  • Why string compare is false?

    Hello,
    I've been confused for a while, could you mind helping?
    This small code compare two strings, not know why but always false.
    ==
    String date_zero = "0000-00-00";
    out.println("cs is "+date_claim_set); // print "cs is 0000-00-00" on screen
    out.println("result is "+date_claim_set.equals(date_zero)); // print "result is false" on screen
    if ( ! date_claim_set.equals(date_zero) ) {
    out.println("strings not equal"); // printed
    ==
    why the two strings are not equal?
    Hope you can help, thanks in advance.
    Rgds, Dove

    masijade. wrote:
    Well, most of his questions lately, have been about MySQL, and "0000-00-00" is the way that MySQL (per default) represents invalid dates, and "YYYY-MM-DD" is the toString() pattern for a java.sql.Date instance. ;-)Sorry for keeping your guys waiting, but I've spent sometimes for reading more material as I can. Now the problem fixed.
    The solution is liked this.
    1) MySQL document said '0000-00-00' is a valid value for date in DB, but a wrong value for JDBC.
    Detail:
    http://dev.mysql.com/doc/refman/5.0/en/connector-j-installing-upgrading.html#connector-j-installing-upgrading-3-0-to-3-1
    2) It is recognized as a problem, so it has been fixed. Instead of using old JDBC Connector/J, new version with re-configuration of zeroDateTimeBehavior can solve.
    I configure it to convertToNull, so in Java I see all value 0000-00-00 from DB as null, works fine.
    Many thanks the ideas from all of you.
    Rgds, Dove

  • String compare question.

    Hi all,
    I have this code here, and don't understand the result came out. Can someone explain this out come ? Thanks.
    String s1 = "Hi";
    String s2 = "Hi";
    if (s1 ==s2) System.out.println("s1=s2");
    String s3 = new String ("Hi");
    String s4 = new String ("Hi");
    if (s3 ==s4) System.out.println("s3=s4");
    Result: It only prints "s1=s2". Why is that ?
    Thanks.
    Pwing

    Hi all,
    I have this code here, and don't understand the result
    came out. Can someone explain this out come ?
    Thanks.
    String s1 = "Hi";s1 is created and put in to the string constant pool. When ever a String literal is encountered, the JVM will first check the string constant pool to see if it already contains a String object with the exactly same data(character sequence). If a match is found, a reference to the existing string is returned, and no new object is created.
    String s2 = "Hi";string constant pool is checked and a string literal with the character sequence "Hi" already exists.
    So, s1 and s2 are both references to the same object.
    if (s1 ==s2) System.out.println("s1=s2");when comparing objects the == operation only tests to see if both references point to the same object. This is true since both s1 and s2 point to the same object in the string constant pool.
    String s3 = new String ("Hi");
    String s4 = new String ("Hi");A string created with the new operartor is not a string literal. The new operator always generates a unique object and returns a reference to that object.
    if (s3 ==s4) System.out.println("s3=s4");
    if you wish to compare the contents of a object use the .equals method.
    Result: It only prints "s1=s2". Why is that ?
    Thanks.
    Pwing

  • Any lib for wildcast String compare

    Hallo,
    Is there any lib supporting String wildcast compare? as filename style in DOS or unix, "files*", "files??To compare".

    http://jakarta.apache.org/oro/index.html

  • String compare QN

    Why does the below 2 syntaxes differs although logically they are doing the same thing?
    1) if ((line.substring(0,6)).toString().equals(temp))
    2) if ((line.substring(0,6)).toString()==temp)

    Is there any API on this maybe I can read up for more
    understanding?Any introductory book on Java should cover this. I glanced over ther Tutorial but couldn't find it, though.
    But it isn't really that hard to understand. What you need to know is that the == operator compares references to objects. It does not compare the contents of the objects. This is what the equals method is supposed to do.
    In your example, you are comparing two different String objects. It doesn't really matter that they happen to represent the same character sequence. The == operator will say that they are different objects. The equals method will compare the character sequences and say that they are equal.

  • String Compare - Accuracy or Similarity rating

    Can someone point me it the right direction or help me out with with a String accuracy/similarity algorithm?
    By this I mean If I compare string "Test" to "Tess" I could get a accuracy rating of 75% etc.
    It needs to be able to also check case sensitivity, things like that.
    Thanks

    prometheuzz wrote:
    avalanche333 wrote:
    Can someone point me it the right direction or help me out with with a String accuracy/similarity algorithm?
    By this I mean If I compare string "Test" to "Tess" I could get a accuracy rating of 75% etc.
    It needs to be able to also check case sensitivity, things like that.
    Thanks
    Using the [Levenshtein distance algorithm|http://www.merriampark.com/ld.htm] on "Test" and "Tess" you get the number one (only 1 change is needed to transform one in the other). Once you have that number, I assume you can do the arithmetic to get to 75%...
    I believe Apache has an open-source library to do that. StringUtils I think it is called, and I believe it is part of the Apache Commons.
    Yes. [http://commons.apache.org/lang/api/org/apache/commons/lang/StringUtils.html].

  • Weird thing in static string comparation

    I am parsing XML file with simple structure:
    <?xml version='1.0' encoding='utf-8'?>
    <list>
            <item>
                    <ingredient id="1" count="1" />
                    <production id="2" count="1" />
            </item>
    </list>I have code block to parse <item> node:
         protected TableEntry parseEntry(Node n)
              TableEntry entry = new TableEntry();
              for(Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
                   if("ingredient".equalsIgnoreCase(d.getNodeName()))
                        // parse it
                        //entry.addIngredient
                        l2p.util.Log.add("loaded ingredient " + id + " count " + count);
                   else if("production".equalsIgnoreCase(d.getNodeName()))
                        // parse it
                        //entry.addProduct
                        l2p.util.Log.add("loaded production " + id + " count " + count);
              if(entry.getIngredients().isEmpty() || entry.getProduction().isEmpty())
                   Log.add("wrong node");
                   for(Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
                        Log.add(d.getNodeName());
                   return null;
              return entry;
         }First block always works fine, but second not:
    loading new entry
    loaded ingridient 1 count 1
    wrong node
    #text
    ingredient
    #text
    production
    #textHow can it be? Looks like
    "production".equalsIgnoreCase(d.getNodeName())
    return false, while d.getNodeName() actually equals "production"
    The most strange:
    Only "production" can broke, never "ingredient".
    About 1/3 of all parsed works fine, but after method become "broken" and skips "production" in all parsed nodes.
    This bug appears only on production server, and never at developers workstation.
    Server:
    Linux server 2.6.28-17-server #58-Ubuntu SMP Tue Dec 1 22:13:36 UTC 2009 x86_64 GNU/Linux
    java version "1.6.0_16"
    Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
    Java HotSpot(TM) 64-Bit Server VM (build 14.2-b01, mixed mode)
    Dev:
    Win7 Ult
    java version "1.6.0_17"
    Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
    Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01, mixed mode)

    Oblitus wrote:
    Which assumptions? I don't know. Like I said: I don't understand what you're trying to say, and I can't be bothered to read your code.
    However, I 100% guarantee that you are making some assumptions. Assumptions about how Java works. Assumptions about what your code means to Java. Assumptions about which conditions will be true or not. Assumptions about which variables get assigned which values and when. Assumptions about how your mental idea of your algorithm and you code implemenation of that idea map to each other. And I also guarantee you that at least one of those assumptions is wrong.
    So you can choose to believe me, accept that Java is behaving exactly as it's supposed to, or you can assume that the problem is with Java, file a bug report, and find a workaround.
    I comparing
    "production".equalsIgnoreCase(d.getNodeName()) when d.getNodeName() equals "production" and it returns false!You're assuming that's what's happening. I am highly confident that that assumption is wrong, and that's not really what's happening.
    The only way you'll solve your problem is if you ask yourself, "What am *I* doing wrong?" and accept that it could be anything, even the things you're 100% sure you're doing right. (Actually, especially those things.)

  • String compare in select statement

    Hi All,
    i have a problem in select statement. i have a name field in my selection screen, i am using name field to comapre string in my select statement, but i am not getting the resule can anyone suggest me on this . please find my code below,s_name1 is my select option name.
    IF s_name1-low IS NOT INITIAL.
    LOOP AT S_NAME1.
      CONCATENATE s_name1-low '%' INTO s_name1-low.
      TRANSLATE s_name1-low TO UPPER CASE.
      s_name1-option = 'CP'.
      MODIFY s_name1.
    ENDLOOP.
    ENDIF.
    SELECT lifnr land1 name1 ort01 ort02 pfach pstl2 pstlz regio stras
             erdat ernam ktokk loevm sperr sperm sperz nodel
        INTO (gs_vendor-vendor_num, gs_vendor-land1, gs_vendor-name,
              gs_vendor-ort01, gs_vendor-ort02, gs_vendor-pfach,
              gs_vendor-pstl2, gs_vendor-pstlz, gs_vendor-regio,
              gs_vendor-stras, gs_vendor-created_on, gs_vendor-created_by,
              gs_vendor-account_gp, gs_vendor-deletion_flag,
              gs_vendor-central_post, gs_vendor-ctr_purch_block,
              gs_vendor-payment_block, gs_vendor-central_deletion)
        FROM  lfa1
             WHERE  lifnr  IN s_lifnr
             AND    name1  LIKE s_name1
    Start of Change G9007789 03/12/2008 - D01K946651
    Additional selection criteria added for City and Region
             AND    ort01  IN s_ort01
             AND    regio  IN s_regio
    End of Change G9007789 03/12/2008 - D01K946651
             AND    ktokk  IN s_ktokk
             AND    ( ktokk  NE 'ZHMT' AND ktokk NE 'ZTER' ).
        APPEND gs_vendor TO gt_vendor.
        CLEAR gs_vendor.
      ENDSELECT.

    Hi,
    Have you checked whether you have given proper events.
    Check this code below.
    AT selection screen output. "Change here
    IF s_name1-low IS NOT INITIAL.
    LOOP AT S_NAME1.
    CONCATENATE s_name1-low '%' INTO s_name1-low.
    TRANSLATE s_name1-low TO UPPER CASE.
    s_name1-option = 'CP'.
    MODIFY s_name1.
    ENDLOOP.
    ENDIF.
    Start-of-Selection. " change here
    SELECT lifnr land1 name1 ort01 ort02 pfach pstl2 pstlz regio stras
    erdat ernam ktokk loevm sperr sperm sperz nodel
    INTO (gs_vendor-vendor_num, gs_vendor-land1, gs_vendor-name,
    gs_vendor-ort01, gs_vendor-ort02, gs_vendor-pfach,
    gs_vendor-pstl2, gs_vendor-pstlz, gs_vendor-regio,
    gs_vendor-stras, gs_vendor-created_on, gs_vendor-created_by,
    gs_vendor-account_gp, gs_vendor-deletion_flag,
    gs_vendor-central_post, gs_vendor-ctr_purch_block,
    gs_vendor-payment_block, gs_vendor-central_deletion)
    FROM lfa1
    WHERE lifnr IN s_lifnr
    AND name1 LIKE s_name1
    Start of Change G9007789 03/12/2008 - D01K946651
    Additional selection criteria added for City and Region
    AND ort01 IN s_ort01
    AND regio IN s_regio
    End of Change G9007789 03/12/2008 - D01K946651
    AND ktokk IN s_ktokk
    AND ( ktokk NE 'ZHMT' AND ktokk NE 'ZTER' ).
    APPEND gs_vendor TO gt_vendor.
    CLEAR gs_vendor.
    ENDSELECT.
    Reward if helpful.
    Regards.

Maybe you are looking for

  • How do I change the aspect ratio on Final Cut Pro X?

    Whenever I upload new media (regardless of what ratio it was filmed in) it plays in letterbox format. I would like to change the aspect ratio to 16:9. Thanks.

  • Acrobat 7.0When printing multiple-up

    When printing multiple-up, how do I get Acrobat to NOT add its own margins? It reduces the size of 8.5x11 documents when printing 2-up on an 11x17 sheet

  • How to make table

    hi, i have a 2 tables of same structure ,i want to make a new table from thoese tables, but problem is that both table has some same data & i want to make new a table that should not have duplicate data . table 1 table 2 table 3 must be 123 200701 12

  • My iphone4 photos show up as .rtfd files

    When I upload photos from my iphone to my mac the files show up as .rtfd not jpeg. This happens regardless of where I save the file; desktop or iphoto. I'm sure I am doing something wrong here as this just doesn't seem logical. Any guidance would be

  • Offline Media

    I have AME 2014.1 set to not render when there is any offline media.  The render will fail with the sheep sound and provide the offline media explanation.  That's fine, it stops me from wasting time on an export that I won't be able to use. The probl