Java Utililty Methods String Index Of

List of utility methods to do String Index Of

Description

The list of methods to do String Index Of are organized into topic(s).

Method

int[]getAllIndex(String source, String rex)
get All Index
ArrayList<Integer> list = new ArrayList<Integer>();
int position = 0;
while (position < source.length()) {
    int index = source.indexOf(rex, position);
    if (index > -1) {
        list.add(source.indexOf(rex, position));
        position = index + 1;
    } else {
...
ListgetIndexesOf(String word, String value)
get Indexes Of
List<Integer> indexes = new ArrayList<Integer>();
for (int index = word.indexOf(value); index != -1; index = word.indexOf(value, index + 1)) {
    indexes.add(index);
return indexes;
ListgetIndexOfChar(String str, String start, String end)
get Index Of Char
int starIndex = 0;
List<Integer> list = new ArrayList<Integer>();
while (true) {
    int a = 0;
    if (list.size() % 2 == 0) {
        a = str.indexOf(start, starIndex);
    } else {
        a = str.indexOf(end, starIndex);
...
StringgetIndexOrConstraintName(String command)
get Index Or Constraint Name
String[] lines = command.split("\n");
String indexOrConstraintName = "";
if (lines.length < 1) {
    return indexOrConstraintName;
String line1 = lines[0];
List<Integer> indices = getQuotePositions(line1);
if ((line1.contains("CREATE INDEX") || line1.contains("CREATE UNIQUE INDEX")) && indices.size() >= 4) {
...
StringgetIndexString(T array, String indexPrefix, String separatorPrefix)
get Index String
StringBuilder builder = new StringBuilder();
for (int LCV = 0; LCV < array.size(); LCV++) {
    builder.append(indexPrefix);
    builder.append(array.get(LCV));
    builder.append(separatorPrefix);
    if (LCV != array.size() - 1) {
        builder.append(", ");
return builder.toString();
ListgetLowerBoundsOfAllStrings(int length, int seedIndex, int routeLength)
get Lower Bounds Of All Strings
List<Integer> lowerBounds = new ArrayList<>();
for (int i = 1; i <= length; i++) {
    int lower = seedIndex - (length - i);
    int upper = seedIndex + (i - 1);
    if (lower >= 0 && upper < routeLength) {
        lowerBounds.add(lower);
return lowerBounds;
ListgetMatchingIndexes(final String source, final String match)
Returns a list containing all the indexes at which match occurs in source .
final List<Integer> indexes = new ArrayList<Integer>();
int index = ((source.indexOf(match) + match.length())) - 1;
while (index >= 0) {
    while (source.charAt(index) != '{') {
        index++;
    indexes.add(index);
    index = source.indexOf(match, index + 1);
...
StringgetMergedLine(String lineOne, String lineTwo, int insertingIndex)
get Merged Line
ArrayList<String> lstLineOne = new ArrayList<String>(Arrays.asList(lineOne.split(",")));
ArrayList<String> lstLineTwo = new ArrayList<String>(Arrays.asList(lineTwo.split(",")));
for (int i = 0; i < lstLineTwo.size(); i++) {
    lstLineOne.add(insertingIndex + i, lstLineTwo.get(i));
return strArrayListToString(lstLineOne);
int[]getNewlineIndexes(String src)
get Newline Indexes
ArrayList<Integer> indexes = new ArrayList<>();
int cur = 0;
while ((cur = src.indexOf("\n", cur) + 1) - 1 != -1 && !(src.replace("\\s+", "")).isEmpty()) {
    indexes.add(cur);
return indexes.stream().mapToInt(i -> i).toArray();
ListgetOffspringStrings(int startIndex, String treeStr)
Return a list of strings representing the children descending from the subtree that begins at the position startIndex
ArrayList<String> children = new ArrayList<String>();
treeStr = treeStr.trim();
int lastParen = matchingParenIndex(startIndex, treeStr);
int i = startIndex + 1;
StringBuffer cstr = new StringBuffer();
int count = 0;
for (i = startIndex + 1; i < lastParen; i++) {
    if (treeStr.charAt(i) == '(')
...