Thread Tools Display Modes
Prev Previous Post   Next Post Next
05-01-09, 01:19 PM   #20
jadakren
A Flamescale Wyrmkin
 
jadakren's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2007
Posts: 103
try this :

Code:
local name = "Lightning Charged Iron Dwarf"
local output = ""
local count = 0
local nameCount = 0;string.gsub(name,"(%w+)", function(w) nameCount = nameCount+1 end)


for token in name:gmatch("%a+") do
 count=count+1;
 output = output .. ((count<nameCount) and string.sub(token,1,1)..". " or token)
end

print(output)
I'm sure there is a better/shorter way of returning an integer that represents the amount of words in a string.

possibly even a better way to do this overall, but this outputs :

L. C. I. Dwarf

Last edited by jadakren : 05-01-09 at 01:43 PM.
  Reply With Quote
 

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Converting DogTag for use with oUF


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off