---
layout: doc
title: strings / trim
---
# trim

### NAME

    trim() - Remove leading and trailing whitespaces

### SYNOPSIS

    string trim( string str );
    string trim( string str, string ch);

### DESCRIPTION

    Remove all leading and trailing whitespace (or other characters 'ch')
    from the string 'str' and return a new string.

### SEE ALSO

    ltrim(3), rtrim(3)
