time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

README.md (3002B)


      1 <!--
      2 
      3 @license Apache-2.0
      4 
      5 Copyright (c) 2021 The Stdlib Authors.
      6 
      7 Licensed under the Apache License, Version 2.0 (the "License");
      8 you may not use this file except in compliance with the License.
      9 You may obtain a copy of the License at
     10 
     11    http://www.apache.org/licenses/LICENSE-2.0
     12 
     13 Unless required by applicable law or agreed to in writing, software
     14 distributed under the License is distributed on an "AS IS" BASIS,
     15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16 See the License for the specific language governing permissions and
     17 limitations under the License.
     18 
     19 -->
     20 
     21 # splitGraphemeClusters
     22 
     23 > Split a string by its [grapheme cluster][unicode-text-segmentation] breaks.
     24 
     25 <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
     26 
     27 <section class="intro">
     28 
     29 </section>
     30 
     31 <!-- /.intro -->
     32 
     33 <!-- Package usage documentation. -->
     34 
     35 <section class="usage">
     36 
     37 ## Usage
     38 
     39 ```javascript
     40 var splitGraphemeClusters = require( '@stdlib/string/split-grapheme-clusters' );
     41 ```
     42 
     43 #### splitGraphemeClusters( str )
     44 
     45 Splits a string by its [grapheme cluster][unicode-text-segmentation] breaks.
     46 
     47 ```javascript
     48 var out = splitGraphemeClusters( 'café' );
     49 // returns [ 'c', 'a', 'f', 'é' ]
     50 
     51 out = splitGraphemeClusters( '🍕🍕🍕' );
     52 // returns [ '🍕', '🍕', '🍕' ]
     53 ```
     54 
     55 </section>
     56 
     57 <!-- /.usage -->
     58 
     59 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
     60 
     61 <section class="notes">
     62 
     63 </section>
     64 
     65 <!-- /.notes -->
     66 
     67 <!-- Package usage examples. -->
     68 
     69 <section class="examples">
     70 
     71 ## Examples
     72 
     73 <!-- eslint no-undef: "error" -->
     74 
     75 ```javascript
     76 var splitGraphemeClusters = require( '@stdlib/string/split-grapheme-clusters' );
     77 
     78 var out = splitGraphemeClusters( 'abc' );
     79 // returns [ 'a', 'b', 'c' ]
     80 
     81 out = splitGraphemeClusters( 'Iñtërnâtiônàlizætiøn' );
     82 // returns [ 'I', 'ñ', 't', 'ë', 'r', 'n', 'â', 't', 'i', 'ô', 'n', 'à', 'l', 'i', 'z', 'æ', 't', 'i', 'ø', 'n' ]
     83 
     84 out = splitGraphemeClusters( '\uD834\uDD1E' );
     85 // returns [ '𝄞' ]
     86 
     87 out = splitGraphemeClusters( '! !' );
     88 // returns [ '!', ' ', '!' ]
     89 
     90 out = splitGraphemeClusters( '' );
     91 // returns []
     92 ```
     93 
     94 </section>
     95 
     96 <!-- /.examples -->
     97 
     98 <!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
     99 
    100 <section class="references">
    101 
    102 </section>
    103 
    104 <!-- /.references -->
    105 
    106 <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
    107 
    108 <section class="related">
    109 
    110 </section>
    111 
    112 <!-- /.related -->
    113 
    114 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    115 
    116 <section class="links">
    117 
    118 [unicode-text-segmentation]: http://www.unicode.org/reports/tr29/
    119 
    120 </section>
    121 
    122 <!-- /.links -->