GDL:How to get a list of font names with the '@' symbol ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2023-03-28 04:00 AM - edited 2023-03-28 04:21 AM
The font list is long. How do I display only a list of font names with the "@" symbol?
The following script is incorrect. How should I write?
dim fontNames[]
n = request("FONTNAMES_LIST", "", fontNames)
if STRSTR ("fontNames", "@") =1 then !!! ===There is an error here ?
values "txt_font" fontNames, custom
endif
- Labels:
-
Library (GDL)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2023-03-28 05:05 AM - edited 2023-03-28 05:07 AM
You need to iterate through each item in the font list array and create a new array with only the items you want. And then assign that shortened list back to your fontName parameter.
Give this a go.
dim fontList[]
dim shortFontNames[]
n = request("FONTNAMES_LIST", "", fontList)
k = 1 !! a separate counter for shortfontnames index
for i = 1 to vardim1(fontList) !! iterate through each font name in the array
if STRSTR (fontList[i], "@" ) = 1 then !! check it has an @ symbol in the name
shortFontNames[k] = fontList[i] !! add it to the new lists
k = k+1 !! increase the separate counter by one
endif
next i
values "fontName" shortFontNames
Since AC13 | Current versions AC23.7000 & AC26.5002 | BIMCloud Basic | Python, GDL, VBA, PHP, SQL, CSS
Certified Graphisoft BIM Manger (2022)
Win 10, i9-9900K, 32GB, Quadro P2200, 500GB NVMe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2023-03-28 06:11 AM
Perfect! thank you very much!