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
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
2023-03-28 06:11 AM
Perfect! thank you very much!