Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Guys hi,
Did this last night, a function to compare 2 strings and ignore case but i wonder if there is a more efficient way to do it (maybe recursion) any ideas will come in blessing?
the big numbers 6590 & 97122 return from (_case) have no meanig except for denote it is UPCASE\LOCASE
thanks
Moshe
; strings compare ignore case
(defun stricomp (s0 s1 / _case)
(defun _case (n0)
(cond
((and (>= n0 65) (<= n0 90))
6590 ; upper case
)
((and (>= n0 97) (<= n0 122))
97122 ; lower case
)
); cond
)_case
(cond
((/= (strlen s0) (strlen s1))
nil
)
((eq s0 s1)
t
)
( t
(vl-every
'(lambda (n1 n2)
(cond
((= (_case n1) (_case n2))
(= n1 n2)
)
((= (_case n1) 6590)
(= (+ n1 32) n2)
)
((= (_case n2) 6590)
(= n1 (+ n2 32))
)
( t
(= n1 n2)
)
); cond
); lambda
(vl-string->list s0)
(vl-string->list s1)
); vl-evrey
); case
); cond
); stricomp
Solved! Go to Solution.