wcmatch and null strings

Discussion in 'AutoCAD' started by Jason Piercey, Jul 30, 2004.

  1. Can wcmatch test for a null string?

    This works
    (wcmatch "" "")


    these do not
    (wcmatch "" "\"\"")
    (wcmatch "" (strcat (chr 34) (chr 34)))
     
    Jason Piercey, Jul 30, 2004
    #1
  2. Jason Piercey

    MP Guest

    consider

    (= "" "\"\"")
    (EQ "" "\"\"")
    (EQUAL "" "\"\"")

    (strlen "")
    (strlen "\"\"")
    (strlen(strcat (chr 34) (chr 34)))

    it seems it does actually work
    though I'm not sure how you're trying to apply it


    (setq tstr "")
    (wcmatch tstr "")
    (= tstr "")
    (eq tstr "")
    (equal tstr "")

    ;here you're trying to match a null string pattern to a string with two "
    characters
    ;same there
    you should be getting nil
    are you not???
    is that what you mean by not working?
     
    MP, Jul 30, 2004
    #2
  3. Jason Piercey

    John Uhden Guest

    This is an old one whose credit I attribute to Steve Johnson (down under)...
    (wcmatch str ", ")
    which returns T for empty text including nothing but spaces.

    For example...
    Command: (defun empty (x)(wcmatch x ", "))
    EMPTY

    Command: (vl-remove-if 'empty '("" " " "ok"))
    ("ok")
     
    John Uhden, Jul 30, 2004
    #3
  4. I was attempting to apply it for testing a default
    dimension value, as in...

    (wcmatch value "*<>*,"\"\"")

    which could technically indicate a default

    instead of using

    (or (= "" value) (wcmatch value "*<>*"))
     
    Jason Piercey, Jul 30, 2004
    #4
  5. <nod>

    Thanks John.
     
    Jason Piercey, Jul 30, 2004
    #5
  6. Jason Piercey

    John Uhden Guest

    You are most graciously welcome. And many thanks to Steve.
     
    John Uhden, Jul 30, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.