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

x/ayonli_jsext/cli.ts>stringWidth

A JavaScript extension package for building strong and modern applications.
Latest
function stringWidth
import { stringWidth } from "https://deno.land/x/ayonli_jsext@v0.9.72/cli.ts";

Returns the width of a string.

Examples

Example 1

import { stringWidth } from "@ayonli/jsext/cli";

console.log(stringWidth("Hello, World!")); // 13
console.log(stringWidth("你好,世界!")); // 12
console.log(stringWidth("👋🌍🚀♥️♣")); // 8

Parameters

str: string

Returns

number