> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/sidef-lang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/sidef-lang/programming_tasks/s/strip-whitespace-from-a-string/top_and_tail.md).

# Top and tail

```ruby
var s = " \t\v\r\n\ffoo bar \t\v\r\n\f"
say s.strip_beg.dump     # remove leading whitespaces
say s.strip_end.dump     # remove trailing whitespaces
say s.strip.dump         # remove both leading and trailing whitespace
```

#### Output:

```
"foo bar \t\13\r\n\f"
" \t\13\r\n\ffoo bar"
"foo bar"
```
