TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: 2e4lite on May 22, 2014, 11:40:57 PM

Title: Is it superfluous?
Post by: 2e4lite on May 22, 2014, 11:40:57 PM
(setq lname (strcase (cdr (assoc 2 (tblsearch "layer" lay_chname)) ) ))
In any case, can remove the strcase above (is it superfluous)? why?
Title: Re: Is it superfluous?
Post by: hanhphuc on May 23, 2014, 01:53:03 AM
hi.. If the layer name is in numeric string like "0" "123", case unchanged.
so strcase can be ignored.

Title: Re: Is it superfluous?
Post by: roy_043 on May 23, 2014, 04:16:45 AM
What if tblsearch returns nil?
Title: Re: Is it superfluous?
Post by: pBe on May 23, 2014, 04:58:08 AM
What if tblsearch returns nil?

I was about to post that same question

Assuming lay_chname value is the result of a user typing the layername

Code: [Select]
(if (tblsearch "layer" (setq lname (strcase lay_chname)))
        lname
  )
Title: Re: Is it superfluous?
Post by: dgorsman on May 23, 2014, 10:16:29 AM
Depends on what's being done with the value afterwards.  If its being tested for equality against another string, then it could be important to do it or not, if case sensitivity is an issue.
Title: Re: Is it superfluous?
Post by: chlh_jd on May 26, 2014, 03:27:00 PM
Table name always  ignore case when you use search or change entities's table name or make entities with it , like you use tblsearch / entmod / entmake .
Why we used strcase , just like dgorsman said ,  Easy to use these function which no ignore case , like  wcmatch / = / member etc.  .
Title: Re: Is it superfluous?
Post by: roy_043 on May 27, 2014, 07:21:25 AM
@ 2e4lite: ?
Title: Re: Is it superfluous?
Post by: 2e4lite on May 27, 2014, 09:19:10 PM
I got it.Thanks you all.