9 Commits

Author SHA1 Message Date
Md Kaif
005550e92a
fix(str): zfill should preserve a leading sign (#533)
zfill writes the padding zeros before the whole string, so a leading
+ or - ends up in the middle of the result instead of staying in front.
For example "-5".zfill(4) gave '00-5' where CPython gives '-005'.

CPython inserts the padding after the sign character, and the sign
counts toward the requested width. Write the sign first, then the
zeros, then the rest of the string. delta is still computed before
this, so the total length is unchanged.

The existing tests only covered unsigned strings, which is why this
went unnoticed. Added three asserts alongside them.
2026-07-21 19:09:11 +08:00
thermalPasteMilkshake
e144785436
re-checking (#531) 2026-07-11 10:25:27 +08:00
Rob McMullen
664ce091f8
Added str.splitlines (#523)
* uses same algorithm as CPython, supports all CPython eol characters
  in https://docs.python.org/3/library/stdtypes.html#str.splitlines
2026-06-28 21:56:47 +08:00
blueloveTH
8c4ed3bc34 fix a bug of str 2026-06-02 20:42:03 +08:00
blueloveTH
35917fc5f4 fix #468 2026-03-04 14:30:35 +08:00
blueloveTH
48b70c944e fix #426 2026-01-26 17:50:03 +08:00
blueloveTH
0251f924c3 fix leak and improve pickle 2025-10-08 21:09:14 +08:00
blueloveTH
62491dd99a reimpl str.format 2025-09-17 14:10:26 +08:00
blueloveTH
d3d61dde0c refactor code 2025-09-08 15:41:44 +08:00