Jump to content

case sensitivity


kalai

Recommended Posts

Hi the check with code

 

 

(setq ss1 (ssget "W" pt1 pt2 

'((8 . "FLOOR9"))) 

)

(setq ss1 (ssget "W" pt1 pt2 

'((8 . "Floor9"))) 

)

 

 

Of the two which works.

I have layer name caps in some dwg and small letters in some (as in code) how to write ssget statement common for all dwgs? Is there a possiblity?

 

Help me .

Link to comment
Share on other sites

  • 10 years later...

How about text content, please? Ex:

(setq ss1 (ssget "W" pt1 pt2 '((0. "TEXT")(1 . "FLOOR9"))))

(setq ss1 (ssget "W" pt1 pt2 '((0. "TEXT")(1 . "Floor9"))))

Can I select by text content without being case sensitive? Thank you!

Link to comment
Share on other sites

1 hour ago, Lee Mac said:
(ssget "W" pt1 pt2 '((0 . "TEXT") (1 . "[Ff][Ll][Oo][Oo][Rr]9"))) 

 

Thank you, Lee! It is totally what I need.

Link to comment
Share on other sites

4 hours ago, marko_ribar said:

(setq ss1 (ssget "W" pt1 pt2 '((0. "TEXT")(1 . "FLOOR9,Floor9,floor9"))))

Actually there are many cases. There are 5 letters, so there are 5^2 = 25 cases.

Link to comment
Share on other sites

On 6/3/2023 at 2:17 PM, saunambon654 said:

Actually there are many cases. There are 5 letters, so there are 5^2 = 25 cases.

 

But in all practicality, only these 3 will ever be used, very unlikely to have "floOr9" for example.

 

Lee Macs example covers all cases well

Edited by Steven P
  • Like 2
Link to comment
Share on other sites

There are more than 25 cases... Combinations are included : 5!/2! = 60 cases...

I think that Steven P is right - 25 cases...

 

Actually I've found 16 cases...

Here is what I founded :

 

1.floor
2.fLoor
3.flOor
4.floOr
5.flooR
6.Floor
7.FlOor
8.FloOr
9.FlooR

10.FLoor
11.FLoOr

12.FLooR

13.FLOor
14.FLOOr
15.FLOoR
16.FLOOR

Edited by marko_ribar
  • Like 1
Link to comment
Share on other sites

1. floor
2. Floor
3. fLoor
4. flOor
5. floOr
6. flooR
7. FLoor
8. FlOor
9. FloOr
10. FlooR
11. fLOor
12. fLoOr
13. fLooR
14. flOOr
15. flOoR
16. floOR
17. FLOor
18. FLoOr
19. FLooR
20. fLOOr
21. fLOoR
22. fLoOR
23. flOOR
24. fLOOR
25. FLOOR

Link to comment
Share on other sites

5 hours ago, marko_ribar said:

I've changed my last post - I founded 16 cases, so it's not neither 25, nor 60...

 

Two choices per letter upper or lower case 5 letters

2^5 = 32 possible choices.

 

either do it lee's way (best) or use the strcase funciton to convert everything to upper case and check that way.

 

  • Like 3
Link to comment
Share on other sites

I want a go....

 

10 hours ago, saunambon654 said:

23. flOOR

24. fLOOR

24.a FlOOR

24b. FLoOR....

25. FLOOR

 

 

See.... 25...

Edited by Steven P
  • Like 1
Link to comment
Share on other sites

Here is my code, for anyone who needs.
Thanks for Mr. Lee Mac.

(defun CaseSensitivity (str1 / str2)  
  (and
    str1
    (= (type str1) 'STR)
    (progn
      (setq str2 ""
        i 1)
      (repeat (strlen str1)
    (if (and
          (= (strcase (substr str1 i 1));upper case
         (strcase (substr str1 i 1) T);lower case
         ))
      (setq str2 (strcat str2 (strcase (substr str1 i 1))))
      (setq str2 (strcat str2 "[" (strcase (substr str1 i 1)) (strcase (substr str1 i 1) T) "]")))
    (setq i (1+ i))
    );repeat
      (setq str1 str2)
      );progn
    );and
  str1)

;(CaseSensitivity "floor9") => "[Ff][Ll][Oo][Oo][Rr]9"

 

  • Like 1
Link to comment
Share on other sites

Lets do counting, I can do counting. Let's make it trickier and do binary counting, the first number in the list is the decimal equivalent. Dead handy if each character in a string has only 2 options.

 

1. 00000
2. 00001
3. 00010
4. 00011
5. 00100
6. 00101
7. 00110
8. 00111
9. 01000
10.01001
11.01010
12.01011
13.01100
14.01101
15.01110
16.01111
17.10000
18.10001
19.10010
20.10011
21.10100
22.10101
23.10110
24.10111
25.11000
26.11001
27.11010
28.11011
29.11100
30.11101
31.11110
32.11111

  • Like 3
Link to comment
Share on other sites

1 hour ago, Steven P said:

Lets do counting, I can do counting. Let's make it trickier and do binary counting, the first number in the list is the decimal equivalent. Dead handy if each character in a string has only 2 options.

 

1. 00000
2. 00001
3. 00010
4. 00011
5. 00100
6. 00101
7. 00110
8. 00111
9. 01000
10.01001
11.01010
12.01011
13.01100
14.01101
15.01110
16.01111
17.10000
18.10001
19.10010
20.10011
21.10100
22.10101
23.10110
24.10111
25.11000
26.11001
27.11010
28.11011
29.11100
30.11101
31.11110
32.11111

You're right, Steven. The calculation 2^5 = 32 correct.

Link to comment
Share on other sites

Nice @saunambon654 was thinking about doing the same thing.

 

;;----------------------------------------------------------------------------;;
;; Generate a text search that ignores Case Senesitivity.
;; saunambon654, Lee Mac, mhupp
;; https://www.cadtutor.net/forum/topic/39880-case-sensitivity/#comment-618863 
;; (ssget "X" (list '(0 . "TEXT") (cons 1 (IC "Floor9")))) 
;; (ssget "X" '((0 . "TEXT") (1 . "[Ff][Ll][Oo][Oo][Rr]9"))) 
(defun IC (str1 / str2 i)  
  (if (= (type str1) 'STR)
    (progn
      (setq str2 "" i 1)
      (repeat (strlen str1)
        (if (numberp (read (setq x (substr str1 i 1))))
          (setq str2 (strcat str2 x))
          (setq str2 (strcat str2 "[" (strcase x) (strcase x T) "]"))
        )
        (setq i (1+ i))
      )
    )
  )
  str2
)
Edited by mhupp
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...