Skip to main content
Module

x/fun/mod.ts>string.trim

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Go to Latest
function string.trim
import { string } from "https://deno.land/x/fun@v2.0.0-alpha.6/mod.ts";
const { trim } = string;

Trims whitespace from the beginning and end of a string.

Examples

Example 1

import { trim } from "./string.ts";

const result1 = trim("Hello World"); // "Hello World"
const result2 = trim("  Hello World"); // "Hello World"
const result3 = trim("Hello World  "); // "Hello World"
const result4 = trim(" Hello World "); // "Hello World"

Parameters

a: string

Returns

string