sequence function: string-replace

    description:
        string-replace(seq, sp, ket)
        for the sequence seq, for every label in sp, replace with ket.label

    examples:
        string-replace(|sad>, |happy>) (|a> . |sad> . |fellow>)
            |a> . |happy> . |fellow>

        string-replace(|${date}>, extract-value current-date |> ) |Today's date is ${date}.>
            |Today's date is 2018-07-11.>

        -- remove " chars:
        remove-quotes (*) #=> string-replace(|">, |>) |_self>
        
        remove-quotes |text: "some text">    
            |text: some text>

        -- replace "  " with " "
        -- ie, double space with single space:
        chomp-double-space (*) #=> string-replace(|  >, | >) |_self>

        -- put it to use:
        chomp-double-space |some     text>
            |some   text>

        chomp-double-space^10 |some     text>
            |some text>

        -- remove punctuation chars:
        -- :;.,!?$-"'
        remove-punctuation (*) #=> string-replace(split[""] |:;.,!?$-"'>, |>) |_self>
        
        -- now put it to use:
        remove-punctuation |some, ... ! $$? noise-text>
            |some    noisetext>
            
    see also:
        replace

Home