operator: remove-prefix

    description:
        remove-prefix["str"] |x>
        remove prefix "str" from the ket |x>, if it exists
        
        remove-prefix[n] |x>
        remove first n chars from |x>
            
    examples:
        -- remove prefix "not " if it exists:
        remove-prefix["not "] |not sitting at the beach>
            |sitting at the beach>
            
        -- do nothing if it doesn't have the right prefix:
        remove-prefix["xyz"] |abcdefg>
            |abcdefg>
    
        remove-prefix["word: "] |word: fish>
            |fish>
        
        -- if prefix is an int, then remove n chars:
        remove-prefix[3] |abcdefg>
            |defg>
    
    see also:
        remove-suffix   

Home