lowercase at "cond"

Discussion in 'AutoCAD' started by Adesu, Aug 9, 2004.

  1. Adesu

    Adesu Guest

    (setq psiz (getstring "\nENTER PAPER TYPE [A1/A2/A3/A4]: " T))
    (setq pans psiz)
    (setq a1 '(800 568))
    (setq a2 '(550 390))
    (setq a3 '(380 270))
    (setq a4 '(260 184))
    (setq opt
    (cond ((= pans "A1")(setq siza1 a1))
    ((= pans "A2")(setq siza2 a2))
    ((= pans "A3")(setq siza3 a3))
    ((= pans "A4")(setq siza4 a4))
    ) ; end of cond
    ) ; end of setq

    Hi Alls,if user put lowercase (exp.a1),cond = nil,how to "cond" accept
    lowercase and uppercase,thanks for your appreciated.
    Best regards
    Ade Suharna
     
    Adesu, Aug 9, 2004
    #1
  2. Adesu

    Adesu Guest

    $ (setq psiz (getstring "\nENTER PAPER TYPE [A1/A2/A3/A4]: " T))
    (setq pans psiz)
    (setq a1 '(800 568))
    (setq a2 '(550 390))
    (setq a3 '(380 270))
    (setq a4 '(260 184))

    (setq opt
    (cond ((= pans "A1")(setq siza1 a1))
    ((= pans "A2")(setq siza2 a2))
    ((= pans "A3")(setq siza3 a3))
    ((= pans "A4")(setq siza4 a4))
    )
    )
    "a1"
    "a1"
    (800 568)
    (550 390)
    (380 270)
    (260 184)
    nil >>>>>>>>>>>>>>??????????
    _$
     
    Adesu, Aug 9, 2004
    #2
  3. Adesu

    Tom Smith Guest

    Use strcase to convert the user's input to the proper case.
    For instance

    (setq psiz (strcase (getstring T "\nENTER PAPER TYPE [A1/A2/A3/A4]: ")))

    will return the response in upper case. Note that your T was in the wrong place.

    Another option is to use getkword, which will return a predictable string.
     
    Tom Smith, Aug 9, 2004
    #3
  4. Adesu

    Adesu Guest

    Thanks a lot Tom
     
    Adesu, Aug 9, 2004
    #4
  5. Adesu

    Jürg Menzi Guest

    Hi Adesu
    Code:
    (setq SizLst (list
    (cons "A1" '(800 568))
    (cons "A2" '(550 390))
    (cons "A3" '(380 270))
    (cons "A4" '(260 184))
    )
    )
    (initget 1 "A1 A2 A3 A4")
    (setq psiz (getkword "\nENTER PAPER SIZE [A1/A2/A3/A4]: ")
    pans (cdr (assoc psiz SizLst))
    )
    
    Cheers
     
    Jürg Menzi, Aug 9, 2004
    #5
  6. Adesu

    Adesu Guest

    Dear Alls,I still confuse for put T on user input, last time others forum
    said put T as "option 1" and others said as "option 2",and we check the both
    option is Ok, where the true ?
    Best regards
    Ade Suharna
    ;-------------------------------
    option 1 (setq psiz (strcase (getstring T "\nENTER PAPER TYPE [A1/A2/A3/A4]:
    ")))
    or
    option 2 (setq psiz (strcase (getstring "\nENTER PAPER TYPE [A1/A2/A3/A4]:
    " T)))
    ;---------------------------------

    _$ (setq psiz (strcase (getstring T "\nENTER PAPER TYPE [A1/A2/A3/A4]: ")))
    "A2"
    _$ (setq psiz (strcase (getstring "\nENTER PAPER TYPE [A1/A2/A3/A4]: " T)))
    "A2"
     
    Adesu, Aug 23, 2004
    #6
  7. Adesu

    zeha Guest

    Adesu,

    The argument T is for blank spaces

    If you hit 'Ade Suharna'

    In case (getstring T msg) it's the complete name

    In case (getsrting nil msg) it's only the first name.
    The way you wrote gives the same result while both arguments are T
    If you hit 'a1/a2' psiz is set to A1/A2

    Note

    The better way is getkword like Jürg Menzi wrote
    Then the uppercase is not nessesary

    Cheers,

    Harrie
     
    zeha, Aug 23, 2004
    #7
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.