| 293 | } |
| 294 | |
| 295 | @StarlarkMethod( |
| 296 | name = "strip", |
| 297 | doc = |
| 298 | "Returns a copy of the string where leading or trailing characters that appear in " |
| 299 | + "<code>chars</code> are removed. Note that <code>chars</code> " |
| 300 | + "is neither a prefix nor a suffix: all combinations of its value " |
| 301 | + "are removed:" |
| 302 | + "<pre class=\"language-python\">" |
| 303 | + "\"aabcbcbaa\".strip(\"ab\") == \"cbc\"" |
| 304 | + "</pre>", |
| 305 | parameters = { |
| 306 | @Param(name = "self", doc = "This string."), |
| 307 | @Param( |
| 308 | name = "chars", |
| 309 | allowedTypes = { |
| 310 | @ParamType(type = String.class), |
| 311 | @ParamType(type = NoneType.class), |
| 312 | }, |
| 313 | doc = "The characters to remove, or all whitespace if None.", |
| 314 | defaultValue = "None") |
| 315 | }, |
| 316 | useStarlarkThread = true) |
| 317 | public String strip(String self, Object charsOrNone, StarlarkThread starlarkThread) { |
| 318 | return stripSemantics(self, charsOrNone, starlarkThread.getSemantics()); |
| 319 | } |
| 320 | |
| 321 | public String stripSemantics( |
| 322 | String self, Object charsOrNone, StarlarkSemantics starlarkSemantics) { |