Code Red > AutoLISP (Vanilla / Visual)

list manipulation...

(1/1)

Andrea:
Hi all..
I have this..


--- Code: ---(setq lstttf (vl-registry-descendents "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts" ""))
--- End code ---

result =

--- Code: ---("AMGDT (TrueType)" "AmdtSymbols (TrueType)" "AIGDT (TrueType)"......)
--- End code ---

after use this.

--- Code: ---(foreach n lstttf
   (setq eet (vl-string-right-trim " \(TrueType)" n))
   (setq lstttf1 (append lstttf1 (list eet)))
)
--- End code ---

result =

--- Code: ---("AMGD" "AmdtSymbols" "AIGD" .......)
--- End code ---

the question is...

AMGD ??
AIGD ??

the T is missing..
so how do i get the name of truetype without "(TrueType)" ??

 :|

Jeff_M:
Here's one way:

--- Code: ---(setq lstttf (vl-registry-descendents "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts" ""))
(setq lstttf (mapcar '(lambda (x)
(vl-string-subst "" " (TrueType)" x)
)
     lstttf))
--- End code ---

zoltan:
The VL-String-Right-Trim and VL-String-Left-Trim remove all charcaters that are included in the pattern string:

$ (vl-string-right-trim "bc" "abababcbcbcbcb")
"ababa"

Andrea:
vl-string-subst  !!!

OOOOUUUIIINNN !!!
why i didn't think more some time !! :ugly:

thanks.

Navigation

[0] Message Index

Go to full version