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.

Similar Messages

  • [svn] 2788: fix asc commandline tests, use wildcards for build number is usage baselines

    Revision: 2788
    Author: [email protected]
    Date: 2008-08-08 10:47:32 -0700 (Fri, 08 Aug 2008)
    Log Message:
    fix asc commandline tests, use wildcards for build number is usage baselines
    Modified Paths:
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/avmtarget.err
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/avmtargetn.err
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/config.err
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/help1.err
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/help2.err

    [mi] EQ overflowing. The server is probably stuck in an infinite loop.
    Seems a little suspicious, though its kind of a generic error message.  Lots and lots of google hits on that one.
    Are you sure none of the libs or executables for xorg-* got damaged before the system called for an fsck?  The power went out on me once and my hard drive "forgot" about 75% of my kernel modules, although it was a conventional hard drive and not an SSD.
    try re-installing some packages:
    pacman -S xorg xf86-video-ati ati-dri libgl
    (any more anyone can think of?)
    [edit]
    Is your copy of that bootchart that blurry or is flicker messing with it?  It looks like its been resized even at largest setting. I can hardly read it.
    Last edited by wriggary (2010-01-29 04:43:02)

  • Using wildcards in strings

    Hi all, I was wondering if it's possible to use wildcards in NSStrings?
    So for example say my text is:
    "The quick brown fox jumps over the lazy dog".
    And I want to extract the string "quick brown fox".
    Something like?
    (@"quick*fox");
    Is there a wildcard that can be used to extract the text between quick and fox? I know I could just strip out 'quick brown fox', but what if I didn't necessarily know it was 'brown' between them, and it was some other word?
    Thanks a bunch!

    There are a couple of regex libraries in the open source.

  • Use Operator == for String Comparison

    Hi,
    I would like to know more about the impact of using operator == in String Comparison.
    From the reference I get, it state this :
    "Operator (==) compares two object addresses to see whether it refers to the same object."
    I've tested it with 2 codes as below :
    Code 1:
              String Pass1 = "cosmo";
              String Pass2 = "cosmo";          
    if (Pass1==Pass2)
                   System.out.println("1&2:same");
              else
                   System.out.println("1&2:not same");
    Output : 1&2:same
    Code 2:
              String Pass3 = new String("cosmo");
              String Pass4 = new String("cosmo");
              if (Pass3==Pass4)
                   System.out.println("3&4:same");
              else
                   System.out.println("3&4:not same");
    Output : 3&4:not same
    Can anyone kindly explain why is the result so? If operator == compares the addresses, isn't it that the 1st code should also have the output :"1&2:not same".

    Can anyone kindly explain why is the result so?It's an implementation artifact. Strings are pooled internally and because of that any String literal will be represented by exactly one object reference.
    Knowledge of this shouldn't be utilized though. It's safer to follow the basic rule: Use == to compare object references and equals to compare object values, such as String literals.

  • Can't use wildcard for cache manifest

    Hi,
    I am still trying to work with the cache manifest in firefox... Now I have a basic problem. I tryed to use wildcard "*" in the manifest and it only works after NETWORK but not after CACHE MANIFEST or CACHE. Here goes a simple version that is not working:
    CACHE MANIFEST
    # rev: 1
    CACHE:
    What I want is to cache every image that is shown in the page without having to explicitly declare it in the manifest, as it is showed dynamicaly acording to each user....

    A good place to ask advice about web development is at the MozillaZine "Web Development/Standards Evangelism" forum.
    *http://forums.mozillazine.org/viewforum.php?f=25
    The helpers at that forum are more knowledgeable about web development issues.<br>
    You need to register at the MozillaZine forum site in order to post at that forum.

  • Using StartsWith for String Comparision in Business rules

    hi,
    I need to compare whether a particular string starts with some pre-defined prefixes. These are bound to change from time to time and hence we wanted to use the business rule engine for this. We declared prefixes using "list of values" vocab and
    defined the set. Now, I hoped to use the String.StartsWith() method but couldn't understand if it can be used.
    As of now, we are creating a method and that will be called with 2 parameters. One the string and other is one of the list of values which we want the string to start with. Is there any better way to do this?
    Praveen Behara
    MCST : BizTalk Server 2006 R2, 2010

    Hi Murugesan,
    I need to match a particular series of numbers... say 12xxx,345xxx,567xxx. I am creating a
    Series as a list and the valid values would be 12, 345, 567. I intend to keep them as prefixes i.e. they are not regular expressions. So, they won't be 12.*, 345.*, 567.*. The idea is to keep the vocab close to requirement
    and away from implementation (typically, for a business user). Now, if I want this setup, how will the implementation with
    Match look like?
    Technically, your above solution would work.. but my way of implementation / thought process is for a different purpose.
    Praveen Behara
    MCST : BizTalk Server 2006 R2, 2010

  • Using concat for STrings

    I'm trying to concat a specified string, ".jpg", to a string of the form:
    filestring = afile.getName();
    filestring.concat(".jpg");
    Why does it not add the .jpg to the end of what filestring is?

    Cuz Strings are immutable dingbat. If you'd read the api you might notice concat returns a new string with the value you want, but you're chucking it since you didn't assign the result to a variable.
    Options:
    1) filestring = afile.getName() + ".jpg"
    2) filestring = afile.getName().concat(".jpg");
    3) filestring = afile.getName(); filestring = filestring.concat(".jpg");
    3) use StringBuffer instead

  • Using CharAt for String Manipulation

    Hi,
    I am new to Java and am taking a Java class. I am trying to put a social security number in "nnn-nn-nnnn" format where n is a digit 0-9. I don't know if it would work with the charAt method of the String class. Does anyone have any suggestions on how to implement this kind of manipulation.
    It would be greatly appreciated!
    Thanks,
    waggypup99

    You could just create a class for social security number.
    e.g.
    public class SSNum{
        private int _num;
        public SSNum(int number){
          _num = number;
          * take number in the form  nnn-nn-nnnn
        public SSNum(String number){
          StringTokenizer st = new StringTokenizer(number,"-");
          StringBuffer numStringB = new StringBuffer(st.nextToken());
          numStringB.append(st.nextToken());
          numStringB.append(st.nectToken());
         _num = Integer.parseInt(numStringB.toString());
       public String toString(){
          //left as fun exercise
    }

  • [Solved] Using diff for directory compare

    I'm interested in using diff specifically to verify data integrity; that is, to make sure each file in dirA is data-identical to the corresponding file in dirB. I'm pretty sure it does that, I just want to verify it's not 'assuming identical' if size and timestamps are the same. Thanks.
    Last edited by alphaniner (2014-04-09 13:17:16)

    Wait, no, that wasn't a sufficient test. Again with only one invocation of 'touch' so the change times are the same:
    % touch -amt 201301011234.20 foo/foo bar/foo
    % stat bar/foo foo/foo
    File: 'bar/foo'
    Size: 6 Blocks: 8 IO Block: 4096 regular file
    Device: fe01h/65025d Inode: 341815 Links: 1
    Access: (0644/-rw-r--r--) Uid: ( 1000/ trent) Gid: ( 100/ users)
    Access: 2013-01-01 12:34:20.000000000 -0500
    Modify: 2013-01-01 12:34:20.000000000 -0500
    Change: 2014-04-09 08:18:44.000000000 -0400
    Birth: -
    File: 'foo/foo'
    Size: 6 Blocks: 8 IO Block: 4096 regular file
    Device: fe01h/65025d Inode: 341873 Links: 1
    Access: (0644/-rw-r--r--) Uid: ( 1000/ trent) Gid: ( 100/ users)
    Access: 2013-01-01 12:34:20.000000000 -0500
    Modify: 2013-01-01 12:34:20.000000000 -0500
    Change: 2014-04-09 08:18:44.000000000 -0400
    Birth: -
    % diff -qr foo bar
    Files foo/foo and bar/foo differ
    Last edited by Trent (2014-04-09 12:16:40)

  • Can i use wildcards in function module .

    Hi All,
             I am using 3 input parameter in my function module .Can i use wildcards for one of the parameter .If so please kindly let me know the procedure.if u give sample code it will be great.
    Thanks,
    Veera

    Hey Wayne....that helped alot. I simplified the formula a bit for this question but your answer led be to my answer. I plugged in the "isblank" function into my formula to get the state of the cell.
    For general reference, this is my final formula:
    =IF((ISBLANK(S2)),F2−E2,0)
    It's saying "if S2 is empty then run the formula "F2-E2" else (if S2 is not empty) then print "0".
    Thanks again.
    Update: based on the answers, here is another way to sove my probem:
    =IF(D2="",F2−E2,0)
    If "D2" is blank then run "F2-E2" or else show 0.

  • [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. 

  • How to search for files using wildcards * and ?.

    Hi All,
    I've been searching the forum for a couple of hours now and have been unable to find a good example of how to search a directory (Windows OS) for a file using wildcards * and/or ?. Does anyone out there have a good example that they can share with me?
    Thanks

    Hi All,
    First of all I want to thank everyone for taking the time to respond to my question. All of your responses where greatly appreciated.
    I took the example code that was posted by rkconner, thanks rkconner, and modified it to allow me to search for files in a directory that contain * and/or ?. Yes, I said and/or! Meaning that you can use them both in the same file name, example: r??d*.t* would find readme.txt.
    I've posed my complete and thoroughly document code below. I hope it is very helpful to other as I have searched many forums and spent many hours today trying to resolve this problem.
    Enjoy
    * File Name: WildcardSearch.java
    * Date: Jan 9, 2004
    * This class will search all files in a directory using the
    * asterisk (*) and/or question mark (?) as wildcards which may be
    * used together in the same file name.  A File [] is returned containing
    * an array of all files found that match the wildcard specifications.
    * Command line example:
    * c:\>java WildcardSearch c:\windows s??t*.ini
    * New sWild: s.{1}.{1}t.*.ini
    * system.ini
    * Command line break down: Java Program = java WildcardSearch
    *                          Search Directory (arg[0]) = C:\Windows
    *                          Files To Search (arg[1]) = s??t*.ini
    * Note:  Some commands will not work from the command line for arg[1]
    *        such as *.*, however, this will work if you if it is passed
    *        within Java (hard coded)
    * @author kmportner
    import java.io.File;
    import java.io.FilenameFilter;
    public class WildcardSearch
         private static String sWild = "";
          * @param args - arg[0] = directory to search, arg[1] = wildcard name
         public static void main(String[] args)
              String sExtDir = args[0]; // directory to search
              sWild = args[1];   // wild card to use - example: s??t*.ini
              sWild = replaceWildcards(sWild);
              System.out.println("New sWild: " + sWild);
              File fileDir = new File(sExtDir);
              File[] arrFile = fileDir.listFiles(new FilenameFilter()
                   public boolean accept(File dir, String name)
                        return (name.toLowerCase().matches(sWild));
              for (int i = 0; i < arrFile.length; ++i)
                   System.out.println(arrFile.getName());
         }     // end main
         * Checks for * and ? in the wildcard variable and replaces them correct
         * pattern characters.
         * @param wild - Wildcard name containing * and ?
         * @return - String containing modified wildcard name
         private static String replaceWildcards(String wild)
              StringBuffer buffer = new StringBuffer();
              char [] chars = wild.toCharArray();
              for (int i = 0; i < chars.length; ++i)
                   if (chars[i] == '*')
                        buffer.append(".*");
                   else if (chars[i] == '?')
                        buffer.append(".{1}");
                   else
                        buffer.append(chars[i]);
              return buffer.toString();
         }     // end replaceWildcards method
    }     // end class

  • How to use wildcards in REST filter for subscription items

    I am following this documentation:
    String column filters
    Support % (starts with) operator.
    Support * (Contains) operator.
    Does not support (ends with) operator.
    Examples:
    Name=service*
    Name=*g*
    Name=*g -- not allowed
    REST URL:
    http://<ServerURL>/RequestCenter/nsapi/serviceitems/serviceitemsubscription/<columnName>=<wildcardValue>
    I can get filters to work without wildcards, but have had no success using '*' or '%' characters.  Please provide a properly encoded sample URL for
    ServiceItemTypeName starting with 'Virtual'.  I have not been able to get any data returned when using wildcards in a filter.
    Here is what I have tried:
    ServiceItemTypeName=Virtual Server Snapshot
    http://10.8.0.46:8080/RequestCenter/nsapi/serviceitems/serviceitemsubscription/ServiceItemTypeName=Virtual%20Server%20Snapshot
    response: 200
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><AllServiceItems totalCount="1" recordSize="1" startRow="1">
    literal works as expected
    ServiceItemTypeName=Virtual%
    http://10.8.0.46:8080/RequestCenter/nsapi/serviceitems/serviceitemsubscription/ServiceItemTypeName=Virtual%25
    Application-Type=application/xml
    response: 200
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><AllServiceItems totalCount="0" recordSize="0" startRow="1"/>
    expected result not returned
    ServiceItemTypeName=Virtual*
    http://10.8.0.46:8080/RequestCenter/nsapi/serviceitems/serviceitemsubscription/ServiceItemTypeName=Virtual*
    Application-Type=application/xml
    500
    <nsapi-error-response>Internal Error: Invalid parameter values specified or unexpected error.</nsapi-error-response>
    fails with error response

    Hi Dan,
    I don't think you can use wild cards here.
    Please see the Integration Guide for 9.4. Section: "REST API -> Quick Reference".
    Here you'll find a table of what features are supported for the different resources exposed by the API. In there you will find a row for "All Service Items", and you'll see that: Get All, Sorting, Paging and All Filters are supported; Wildcards Name Search are not...
    When I came accross this same situation, I assumed that I am trying to do a Wildcard Name Search here... and it's not supported. It does, however, work for the other (SI Designer created) columns, which is what I believe the documentation is trying to describe. (Though, personally, I feel this is a bug).

  • How to use multiple VCI strings for lap 1300 and 1200 (option 60) in one pool?

    Hi All,
    Hope to you a very happy new year,
    I have two differnt LAP 1300 and 1200 in my network and I need to add theme to the WLC,
    I successed to add one of theme by the option 60 in the DHCP pool at the Core SW,
    So my quetion is below:
    How to use multiple VCI strings for lap 1300 and 1200 (option 60) in one pool?
    Thanks in Advanced,
    Ahmed,

    To add to Scott's post.  Option 60 would be useful if you needed to put certain types of AP on specific controllers.  Otherwise, no real need to use it for the most part.
    Though, I do recall an issue a few years ago that some windows machines had issues getting DHCP if option 43 is being returned.
    Now, on an IOS switch, you can only configure one option 60 per DHCP scope
    HTH,
    Steve
    Please remember to rate useful posts, and mark questions as answered

  • Comparing two columns in two tables using partial text strings and copying data between tables

    I have two tables:
    The Vendor table is supplied by a clothing manufacturer and lists product data by row with a column that contains a unique manufacturer ID, such as T5C4.  In this table is a short product description and a long product description that I need to find and copy into the second table, Inventory.
    The Inventory table is an export from our Magento store.  Each row contains a unique inventory number in a column that includes but does not match the unique manufacturer ID from the Vendor table.  For example, the unique inventory number could be T5C4-W12, or RED-T5C4W12 or some other variation.
    For each product in Inventory, I need to find the matching product in Vendor, and then copy the short description and long description from Vendor to Inventory.
    Any tips?  Thanks!
    Karl

    Karl,
    Here's a start, as you requested.
    The formula for Our Inventory Row is:
    =IFERROR(MATCH("*"&A&"*", Our Inventory :: A, 0), "n/a")
    The formula for Brief Description in the inventory table is:
    =IFERROR(INDEX(ABC Products :: $A$1:$C$9,MATCH(ROW(), ABC Products :: $D, 0), 2), "n/a")
    The formula for the Full description in the inventory table is:
    =IFERROR(INDEX(ABC Products :: $A$1:$C$9,MATCH(ROW(), ABC Products :: $D, 0), 3), "n/a")
    The Manufacturer's table knows the concise product numbers, so it has the ability to search the Inventory table for it's product id's using wildcards and it then displays the line number of the item in the inventory table. The Inventory table can then search the manufacturer's table for its row number and can reference the brief and full descriptions.
    This approach has a serious limitation. It will only find the first occurrence in the inventory. Now, if you want to accept this, you can sort all the found descriptions and pull them out of the inventory table, and then the next product in line will display it's description too.
    I wish I could do better with this, but it's all I can come up with at this point, knowing only what you have told me.
    Jerry

Maybe you are looking for