Commonly used TypeScript/JavaScript API for LeetCode - String

TS刷题常用API: String

Posted by Codingbro on August 7, 2022

WIP:

Preface

This article provides the common JavaScript/TypeScript API for String when you are LeetCoding.

1. Operations on a string

  1. Obtain a substring from the given string
        str.substring(i, j); // Obtain a substring whose starting index is i and ending index is j-1
    

Summary

Please share more JavaScript/TypeScript common API for String during LeetCoding in the comment section below. Thak you.

前言

本文提供笔记哥用 JavaScript/TypeScript 刷题时的常用的 String 相关的的 API。
方便阅读和快速理解,本文尽量提供这些 API 的中文注解。

1. 基于一个 string 类型的操作

  1. 获取 substring
        str.substring(i, j); //获取首字符位于index i,末字符位于index j-1的substring
    

总结

您还有什么要补充的 JavaScript/TypeScript 刷题常用的 String 类 API 吗?如果 YES,请留言,不吝赐教。