Returns a substring of the given string. If the specified range exceeds the length of the string, returns a shorter substring. Args: start: The beginning index, inclusive. Negative numbers count backwards from the end of the string. end: The ending index, exclusive.
(
self, start: _arg_types.Integer, end: _arg_types.Integer | None = None
)
| 205 | return apifunction.ApiFunction.call_(f'{self.name()}.rindex', self, pattern) |
| 206 | |
| 207 | def slice( |
| 208 | self, start: _arg_types.Integer, end: _arg_types.Integer | None = None |
| 209 | ) -> String: |
| 210 | """Returns a substring of the given string. |
| 211 | |
| 212 | If the specified range exceeds the length of the string, returns a shorter |
| 213 | substring. |
| 214 | |
| 215 | Args: |
| 216 | start: The beginning index, inclusive. Negative numbers count backwards |
| 217 | from the end of the string. |
| 218 | end: The ending index, exclusive. Defaults to the length of the string. |
| 219 | Negative numbers count backwards from the end of the string. |
| 220 | |
| 221 | Returns: |
| 222 | The requested portion of the string. |
| 223 | """ |
| 224 | |
| 225 | return apifunction.ApiFunction.call_( |
| 226 | f'{self.name()}.slice', self, start, end |
| 227 | ) |
| 228 | |
| 229 | def split( |
| 230 | self, regex: _arg_types.String, flags: _arg_types.String | None = None |