Skip to main content
Module

x/cliffy/table/mod.ts>consumeWords

Command line framework for deno 🦕 Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...
Extremely Popular
Go to Latest
function consumeWords
import { consumeWords } from "https://deno.land/x/cliffy@v1.0.0-rc.3/table/mod.ts";

Consumes the maximum amount of words from a string which is not longer than given length. This function returns at least one word.

import { consumeWords } from "./mod.ts";

const str = consumeWords(9, "This is an example."); // returns: "This is"

Parameters

length: number

The maximum length of the returned string.

content: string

The content from which the string should be consumed.

Returns

string