I have a string that has no spaces, what marks every single word is the uppercase letter at the beginning of each word, what would be the best way for extracting them?
here’s what i’ve got:
str = "TheseAreAFewWordsAndThis-one-contains-wildcards"
Desired output would be:
These
Are
A
Few
Words
And
This-one-contains-wildcards
I don’t need to treat any magical characters as such, they can stay in the string no problems
>Solution :
for wrd in str:gmatch("%u%U*") do print(wrd) end
"%u%U*" is a string pattern that matches a single capital letter followed by any number of non capital letter characters.
Please read https://www.lua.org/manual/5.4/manual.html#6.4.1