Home › Forums › General › Programming › Removing spaces from ASCII text › Reply To: Removing spaces from ASCII text
September 28, 2013 at 8:02 pm
#13710
OK, I have been trying to make this work and I found this:
-- trim whitespace from right end of string
function trimr(s)
return s:find'^%s*$' and '' or s:match'^(.*%S)'
end
Iām guessing this is related to the String Class Atom made reference to. This is how I got it to work in my method:
nameData = L(PatchLabel:getProperty("uiLabelText"))
function trim (s)
return (string.gsub(s, "^%s*(.-)%s*$", "%1"))
end
nameTrim = (trim(nameData))
fileToWrite = utils.saveFileWindow("Save patch to disk", File(nameTrim), "*.syx", true)
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystal