/* * [TestWildcardExpansion.java] * * Summary: Tests what sort of wildcard expansion happens automatically. * * Copyright: (c) 2009-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.0 2009-04-08 initial release */ // TestWildcardExpansion package com.mindprod.example; import static java.lang.System.*; /* * try with: * java com.mindprod.example.TestWildcardExpansion *.* * java com.mindprod.example.TestWildcardExpansion "*.*" * java com.mindprod.example.TestWildcardExpansion s*.* * java com.mindprod.example.TestWildcardExpansion . * java com.mindprod.example.TestWildcardExpansion *.html * java com.mindprod.example.TestWildcardExpansion afile.txt anotherfile.txt * java com.mindprod.example.TestWildcardExpansion d?mmy.* (where you have dummy.* files and a dummy dir) * java com.mindprod.example.TestWildcardExpansion t?mmy.* (where you don't have tummy.* files or a dummy dir) * java com.mindprod.example.TestWildcardExpansion cert*.html * java com.mindprod.example.TestWildcardExpansion "cert*.html" * java com.mindprod.example.TestWildcardExpansion "cert\*.html" * My discoveries: For Win2K: * Wildcards are automatically expanded before your program sees them. * Who does it? the JRE. It does not happen in C exe or assembler com utilities.. * You get a list of matching files INCLUDING matching directory names, * but not the files in those subdirectories. Since directories normally * don't have extensions, you won't see the problem with *.html but you will * with s*.* or *.*. * If the wildcard does not match anything, you get the raw wildcard. * The wildcard in quotes gives you the raw wildcard. */ /** * Tests what sort of wildcard expansion happens automatically. *

* It is very simple. Just look at the main method code to understand * what it does and what you could use it for. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2009-04-08 initial release * @since 2009-04-08 */ public class TestWildcardExpansion { /** * Echo command line arguments, along with any automatic expansion * Can be used to test wildcard expansion, quoting, or any other basic features * features of command line parsing. * * @param args whatever you want to test. */ public static void main( String[] args ) { out.println( args.length + " arguments" ); for ( String arg : args ) { // [ ] help prove no lead/trail blanks tabs etc. out.println( "[" + arg + "]" ); } } }