版博士V2.0程序
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233
  1. # wcwidth
  2. Determine columns needed for a fixed-size wide-character string
  3. ----
  4. wcwidth is a simple JavaScript port of [wcwidth](http://man7.org/linux/man-pages/man3/wcswidth.3.html) implemented in C by Markus Kuhn.
  5. JavaScript port [originally](https://github.com/mycoboco/wcwidth.js) written by Woong Jun <woong.jun@gmail.com> (http://code.woong.org/)
  6. ## Example
  7. ```js
  8. '한'.length // => 1
  9. wcwidth('한'); // => 2
  10. '한글'.length // => 2
  11. wcwidth('한글'); // => 4
  12. ```
  13. `wcwidth()` and its string version, `wcswidth()` are defined by IEEE Std
  14. 1002.1-2001, a.k.a. POSIX.1-2001, and return the number of columns used
  15. to represent the given wide character and string.
  16. Markus's implementation assumes the wide character given to those
  17. functions to be encoded in ISO 10646, which is almost true for
  18. JavaScript's characters.
  19. [Further explaination here](docs)
  20. ## License
  21. MIT