MCPcopy Create free account
hub / github.com/archlinux/archinstall / unicode_ljust

Function unicode_ljust

archinstall/lib/utils/encoding.py:28–39  ·  view source on GitHub ↗

Return a left-justified unicode string of length width. >>> unicode_ljust('Hello', 15, '*') 'Hello**********' >>> unicode_ljust('你好', 15, '*') '你好***********' >>> unicode_ljust('안녕하세요', 15, '*') '안녕하세요*****' >>> unicode_ljust('こんにちは', 15, '*') 'こんにちは*****'

(string: str, width: int, fillbyte: str = ' ')

Source from the content-addressed store, hash-verified

26
27
28def unicode_ljust(string: str, width: int, fillbyte: str = ' ') -> str:
29 """Return a left-justified unicode string of length width.
30 >>> unicode_ljust('Hello', 15, '*')
31 'Hello**********'
32 >>> unicode_ljust('你好', 15, '*')
33 '你好***********'
34 >>> unicode_ljust('안녕하세요', 15, '*')
35 '안녕하세요*****'
36 >>> unicode_ljust('こんにちは', 15, '*')
37 'こんにちは*****'
38 """
39 return string.ljust(width - _count_wchars(string), fillbyte)
40
41
42def unicode_rjust(string: str, width: int, fillbyte: str = ' ') -> str:

Callers 1

as_tableFunction · 0.90

Calls 1

_count_wcharsFunction · 0.85

Tested by

no test coverage detected