For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /reference/sdk/logs/functions/visibleLen.md.
  • 简体中文
  • Function: visibleLen()

    function visibleLen(s: string): number;

    Defined in: logs/ansi.ts:36

    计算字符串的终端可见字符长度(自动排除 ANSI 颜色与样式转义码)。

    Parameters

    ParameterTypeDescription
    sstring待计算的字符串。

    Returns

    number

    实际可见字符宽度。