Skip to content

tokuhirom/visualwidth-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VisualWidth

This is a unicode character's visual width calculator for javascript.

This module supports node.js, too.

SYNOPSIS

var vw = require('./visualwidth');
console.log(vw('あいうabc')); # => 9
console.log(vw.width('あいうabc')); # => 9
console.log(vw.truncate('ほう。hasegawaさん', 7, '...')); # => "ほう..."
console.log(vw.substr('あいうabc', 1, 4)); # => "いうab"
console.log(vw.substring('あいうabc', 2, 4)); # => "うa"
console.log(vw.indexOf('あいうabc', 'a')); # => 6
console.log(vw.lastIndexOf('あいうabc', 'a')); # => 6)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •