Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/cliffy/table/consume_words.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.1/table/consume_words.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