Have ideas to improve npm?Join in the discussion! »

    mb-substr

    0.0.2 • Public • Published

    mb-substr

    multibyte substr

    Install

    $ npm install mb-substr
    

    Usage

    const mbsubstr = require('mb-substr');
     
    mbsubstr('あいうえお', 2 ,2);
    //=> 'い'
     
    mbsubstr('あいうえお', 2);
    //=> 'いうえお'
     
    mbsubstr('あいうえお', 1, 2);
    //=> ''
     
    mbsubstr('あいうえお', 1, 3);
    //=> 'い'
     
    mbsubstr('aあいうえお', 1, 2);
    //=> 'あ'

    API

    mbsubstr(input, [start, [len]])

    input: string

    start: number

    len: number

    License

    MIT

    Install

    npm i mb-substr

    DownloadsWeekly Downloads

    4

    Version

    0.0.2

    License

    MIT

    Last publish

    Collaborators

    • avatar