I want to shorten mob names from say "Sun Weaver Archer" to "S. W. Archer". I use
Code:
string.gsub(name, "%s?(.[\128-\191]*)%S+%s", "%1. ")
which I found in an addon I use, but must admit I don't understand how it works. What is the
.[\128-\191] part supposed to mean? '.' stands for a single character and the next part is a range of ascii codes from 128 to 191. I found out this is to make it work for non-English languages, as it doesn't work if I use
Code:
string.gsub(name, "%s?(%S)%S+%s", "%1. ")
.
The other problem I have is when I run this for name = "Echo of a Pandaren Monk", it would return "E. o. aP. Monk" (no space between a and P.). How would I fix this.
Would appreciate some explanations about this.