Reply To: Removing spaces from ASCII text

Home Forums General Programming Removing spaces from ASCII text Reply To: Removing spaces from ASCII text

#13710
lfo2vco
Participant
    • Topics: 26
    • Replies: 162
    • Total: 188
    • ā˜…ā˜…

    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

    Ctrlr