View Single Post
09-18-15, 10:17 AM   #8
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
Code:
text = text:gsub("[\1\10\32\34\92#%%%'%(%)%*%+,%-%./%d:;<>=%[%]^{|}~]", space)
text = text:gsub("%s%a%s", space)
text = text:gsub("%s%a%s", space)
text = text:gsub("%s%s+", space)
This works, but repeats the operation twice to get rid of the cases where two single letters are separated by only one whitespace, such as..
Lua Code:
  1. -- Original code
  2. function someFunction(t,f) print(t,f) end
  3.  
  4. -- Step 1
  5. function someFunction t f print t f end
  6.  
  7. -- Step 2
  8. function someFunction f print f end
  9.  
  10. -- Step 3
  11. function someFunction  print  end
  12.  
  13. -- End result
  14. function someFunction print end
__________________

Last edited by MunkDev : 09-18-15 at 10:26 AM.
  Reply With Quote