MCPcopy Index your code
hub / github.com/bazelbuild/bazel / find

Method find

src/main/java/net/starlark/java/eval/StringModule.java:617–645  ·  view source on GitHub ↗
(String self, String sub, Object start, Object end)

Source from the content-addressed store, hash-verified

615 }
616
617 @StarlarkMethod(
618 name = "find",
619 doc =
620 "Returns the first index where <code>sub</code> is found, or -1 if no such index exists, "
621 + "optionally restricting to <code>[start:end]</code>, "
622 + "<code>start</code> being inclusive and <code>end</code> being exclusive.",
623 parameters = {
624 @Param(name = "self", doc = "This string."),
625 @Param(name = "sub", doc = "The substring to find."),
626 @Param(
627 name = "start",
628 allowedTypes = {
629 @ParamType(type = StarlarkInt.class),
630 @ParamType(type = NoneType.class),
631 },
632 defaultValue = "0",
633 doc = "Restrict to search from this position."),
634 @Param(
635 name = "end",
636 allowedTypes = {
637 @ParamType(type = StarlarkInt.class),
638 @ParamType(type = NoneType.class),
639 },
640 defaultValue = "None",
641 doc = "optional position before which to restrict to search.")
642 })
643 public int find(String self, String sub, Object start, Object end) throws EvalException {
644 return stringFind(true, self, sub, start, end);
645 }
646
647 @StarlarkMethod(
648 name = "rindex",

Callers 6

shouldRunMethod · 0.45
mainMethod · 0.45
assertFailsMethod · 0.45
expectedMethod · 0.45
_AssertXmlGenerationMethod · 0.45
splitLinesMethod · 0.45

Calls 1

stringFindMethod · 0.95

Tested by 5

shouldRunMethod · 0.36
mainMethod · 0.36
assertFailsMethod · 0.36
expectedMethod · 0.36
_AssertXmlGenerationMethod · 0.36