Skip to main content
Module

x/denops_std/bufname/utils.ts>encode

📚 Standard module for denops.vim
Go to Latest
function encode
import { encode } from "https://deno.land/x/denops_std@v3.11.3/bufname/utils.ts";

Encode only unusable characters to percent-encoded characters.

This function does not encode the percent character itself to avoid multiple encoding. Users must encode the percent character themselves before using this function like:

const expr = "%Hello world%";
const encoded = encode(expr.replaceAll("%", "%25"));

Note that this function is not the inverse of decode. The decode function decodes all percent-encoded characters, while this function encodes a few characters.

Parameters

expr: string

Returns

string