Filter specific word from string

Filter specific word from string

avinash00002002
Collaborator Collaborator
244 Views
2 Replies
Message 1 of 3

Filter specific word from string

avinash00002002
Collaborator
Collaborator

0xHi!

I have a 4 type of Text but variable name only at one from below like (setq l2c "HT PL 80 x 6 thk) or (setq l2c "L 90X90X6")

1) L 90x90x6

2) HT 90x90x6

3) PL 80 x 6 THK.

4) HT PL 100 x 8 THK

 

I want to filter

1 st as a MS steel angle

2nd as a HT steel angle

3rd as a MS steel plate

4th as a HT steel plate

 

How to filter?

 

Thanks,

 

Avinash

 

0 Likes
Accepted solutions (1)
245 Views
2 Replies
Replies (2)
Message 2 of 3

EnM4st3r
Advocate
Advocate

i dont really understand.. can you explain more on what you want?

0 Likes
Message 3 of 3

komondormrex
Mentor
Mentor
Accepted solution

hey,

possibly like this

(setq texts '("L 90x90x6" "HT 90x90x6" "PL 80 x 6 THK" "HT PL 100 x 8 THK"))

;1 st as a MS steel angle
(setq l2c (vl-remove nil (mapcar '(lambda (match text) (if match text nil))
				   				  (mapcar '(lambda (text) (wcmatch text "L #*")) texts)
				   				  texts
						 )
		  )
)

;2nd as a HT steel angle
(setq l2c (vl-remove nil (mapcar '(lambda (match text) (if match text nil))
				   				  (mapcar '(lambda (text) (wcmatch text "HT #*")) texts)
				   				  texts
						 )
		  )
)

;3rd as a MS steel plate
(setq l2c (vl-remove nil (mapcar '(lambda (match text) (if match text nil))
				   				  (mapcar '(lambda (text) (wcmatch text "PL #*")) texts)
				   				  texts
						 )
		  )
)

;4th as a HT steel plate
(setq l2c (vl-remove nil (mapcar '(lambda (match text) (if match text nil))
				   				  (mapcar '(lambda (text) (wcmatch text "HT PL #*")) texts)
				   				  texts
		  				 )
		  )
)
0 Likes