• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
      • Std/lists
      • Std/alists
      • Obags
      • Std/util
      • Std/strings
        • Pretty-printing
        • Printtree
        • Base64
        • Charset-p
        • Strtok!
        • Cases
        • Concatenation
        • Html-encoding
        • Character-kinds
        • Substrings
        • Strtok
        • Equivalences
        • Url-encoding
        • Lines
        • Ordering
        • Numbers
        • Pad-trim
          • Rpadstr
          • Rpadchars
          • Lpadchars
          • Lpadstr
          • Trim-bag
          • Trim
          • Coercion
          • Std/strings-extensions
          • Std/strings/digit-to-char
          • Substitution
          • Symbols
        • Std/io
        • Std/osets
        • Std/system
        • Std/basic
        • Std/typed-lists
        • Std/bitsets
        • Std/testing
        • Std/typed-alists
        • Std/stobjs
        • Std-extensions
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Pad-trim

    Trim

    Remove whitespace characters from the front and end of a string.

    (trim x) removes whitespace characters from the front and end of the string x.

    Definitions and Theorems

    Function: trim

    (defun trim (x)
           (declare (xargs :guard (stringp x)))
           (let* ((bag (list #\Space
                             #\Tab #\Newline #\Page (code-char 13)
                             (code-char 11))))
                 (trim-bag x bag)))

    Theorem: stringp-of-trim

    (defthm stringp-of-trim (stringp (trim x))
            :rule-classes :type-prescription)