News for hackers. Stuff that matters.
Re:jQuery v4.0 Beta by selcuka on Wednesday February 07, 2024 @07:16AM (#39287627)
> Most language I'm aware of wouldn't have that in their standard lib.

Python has str.ljust [1] (and str.rjust [2]):

> Return the string left justified in a string of length width. Padding is done using the specified fillchar (default is an ASCII space). The original string is returned if width is less than or equal to len(s).

[1] https://docs.python.org/3/library/stdtypes.html#str.ljust

[2] https://docs.python.org/3/library/stdtypes.html#str.rjust

Re:jQuery v4.0 Beta by Macha on Wednesday February 07, 2024 @09:07AM (#39288724)
C has it in their standard library, basically forever. See the list of specifiers to printf. C! If it fits into the C standard library, it's not bloating the Javascript standard library.
Re:jQuery v4.0 Beta by chipotle_coyote on Wednesday February 07, 2024 @09:12AM (#39288773)
Ruby and PHP both have string padding functions. So does Swift. (edit: and as Macha points out, C and any language with printf functionality, like Perl.) It’s not that uncommon.

(I was going to joke that TRS-80 BASIC had it circa 1979, but it turns out that it would be a two-step operation: Python’s str.ljust(40) would become LEFT$(STRING$(40, " "),40) .)