Author Topic: list manipulation...  (Read 2148 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
list manipulation...
« on: April 03, 2006, 03:43:52 PM »
Hi all..
I have this..

Code: [Select]
(setq lstttf (vl-registry-descendents "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts" ""))
result =
Code: [Select]
("AMGDT (TrueType)" "AmdtSymbols (TrueType)" "AIGDT (TrueType)"......)
after use this.
Code: [Select]
(foreach n lstttf
   (setq eet (vl-string-right-trim " \(TrueType)" n))
   (setq lstttf1 (append lstttf1 (list eet)))
)

result =
Code: [Select]
("AMGD" "AmdtSymbols" "AIGD" .......)
the question is...

AMGD ??
AIGD ??

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

 :|
Keep smile...

Jeff_M

  • King Gator
  • Posts: 4097
  • C3D user & customizer
Re: list manipulation...
« Reply #1 on: April 03, 2006, 03:51:26 PM »
Here's one way:
Code: [Select]
(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))

zoltan

  • Guest
Re: list manipulation...
« Reply #2 on: April 03, 2006, 04:36:48 PM »
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

  • Water Moccasin
  • Posts: 2372
Re: list manipulation...
« Reply #3 on: April 03, 2006, 05:06:53 PM »
vl-string-subst  !!!

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

thanks.
Keep smile...