#How to get the initials of a text variable

1 messages · Page 1 of 1 (latest)

urban rain
#

A very newbie question, in

#let home_place = "Federal University of Ceará"

how to get its initials, that is, "FUC"?

smoky cairn
#

?render

#let home-place = "Federal University of Ceará"

#let words = home-place.split()
#let letters = words.map(word => word.at(0))
#letters.join()

#let capletters = letters.filter(l => upper(l) == l)
#capletters.join()
smoky cairn
#

I suggest to get a look of methods of arrays and strings in Typst Reference. There are lots of useful methods you can combine like this.

urban rain
#

Thank you! I actually did it. My solution was

#home_place.split().map(word => word.find(regex("[A-Z]"))).join()

But I had the impression that my solutions wasn't great...