Help with strings!

Hello there people at Julia !
I’m a high-school student and recently I’ve been stuck with this problem in Julia.
I want to get the first characters of the words in a long sentence (after splitting from the blank) and concatenate them together in a new string. I’m able to make this in python though but julia string indexing is confusing me.
Basically, like making an acronym.

I can’t seem to write the code for it although I have a pseudocode in mind.

get string
split at blank spaces and store in a list variable
iterate through splitted words in a list
get the first character
push into a FINAL string 
make the FINAL string all caps
julia> sentence = "This is a sentence"
"This is a sentence"

julia> join([first(i) for i in split(sentence)])
"Tias"
2 Likes

Thanks a ton !
One more thing…
What if a word in the sentence starts with some symbol
like
“I have a $five bill.”

How do I ignore that $ and take that “F” from five ?

One way to do it is using a regex in place of the simple first function: Strings · The Julia Language

Alternatively, see if you can create a function yourself that returns the first alphanumeric character in a given string.

5 Likes