【每日一包0011】pad

王煒發表於2019-02-16

[github地址:https://github.com/ABCDdouyae…]

pad

給字串的左右加padding,也可以用於刪減字串兩端

用法:pad(str, length, options)|pad(length, str, options)

options:

  • char (string): 指定字元填充
  • colors (boolean):Ajust to hidden terminal color characters, you may also use require `pad/lib/colors` to avoid passing this option.
  • strip (boolean):要求的長度小於原字串長度,會對原字串刪減,預設false
  • fixed_width (boolean):An optimization option to disable the usage of the wcwdith package to handle the discovery of characters using more than one column for display. one column to display
  • wcwidth_options (object):Options passed to the wcwidth package used to calculate the display width of characters using more than one column.

返回:string

相關文章