Returns a copy of the BitString with both leading and trailing characters removed. If omitted or None, ``'char'`` defaults to ``"0"``:: BitString("00010101000").rstrip() == BitString("10101") BitString("11110101111").rstrip("1") == BitString("1010")
(self, char: str | None = "0")
| 153 | return BitString(super().rstrip(char), False) |
| 154 | |
| 155 | def strip(self, char: str | None = "0") -> BitString: |
| 156 | """Returns a copy of the BitString with both leading and trailing |
| 157 | characters removed. |
| 158 | If omitted or None, ``'char'`` defaults to ``"0"``:: |
| 159 | |
| 160 | BitString("00010101000").rstrip() == BitString("10101") |
| 161 | BitString("11110101111").rstrip("1") == BitString("1010") |
| 162 | """ |
| 163 | if char is None: |
| 164 | char = "0" |
| 165 | return BitString(super().strip(char)) |
| 166 | |
| 167 | def removeprefix(self, prefix: str, /) -> BitString: |
| 168 | return BitString(super().removeprefix(prefix), False) |