Author Topic: Is it superfluous?  (Read 3182 times)

0 Members and 1 Guest are viewing this topic.

2e4lite

  • Guest
Is it superfluous?
« 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?

hanhphuc

  • Newt
  • Posts: 64
Re: Is it superfluous?
« Reply #1 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.

( apply 'equal "hp" "happy" "hạnh phúc" "ハッピー" "幸福" "행복" ) ; error: too many arguments

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Is it superfluous?
« Reply #2 on: May 23, 2014, 04:16:45 AM »
What if tblsearch returns nil?

pBe

  • Bull Frog
  • Posts: 402
Re: Is it superfluous?
« Reply #3 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
  )

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Is it superfluous?
« Reply #4 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.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

chlh_jd

  • Guest
Re: Is it superfluous?
« Reply #5 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.  .

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Is it superfluous?
« Reply #6 on: May 27, 2014, 07:21:25 AM »
@ 2e4lite: ?

2e4lite

  • Guest
Re: Is it superfluous?
« Reply #7 on: May 27, 2014, 09:19:10 PM »
I got it.Thanks you all.