The list of methods to do String Find are organized into topic(s).
int[]
findAll(final String s, final String subs) find All
if (s.length() == 0 || subs.length() == 0)
return null;
ArrayList<Integer> indices = new ArrayList<Integer>();
int i = 0;
int len = subs.length();
int i0;
while ((i0 = s.substring(i, s.length()).indexOf(subs, i)) != -1) {
indices.add(i0 + i);
...
Integer[]
findAllIndexes(String str, String searchStr) Get all indexes
List<Integer> list = new ArrayList<Integer>();
int index = str.indexOf(searchStr);
while (index >= 0) {
list.add(index);
index = str.indexOf(searchStr, index + searchStr.length());
return list.toArray(new Integer[list.size()]);
ArrayList
findAllOccurences(String str, String pattern)
Find all occurences (start positions) of pattern in string
ArrayList<Integer> pos = new ArrayList<Integer>();
int len = pattern.length();
if (len > 0) {
int start = str.indexOf(pattern);
while (start != -1) {
pos.add(start);
start = str.indexOf(pattern, start + len);
return pos;
int[]
findAllOccurrences(String str, String substr) Returns an array of integers listing the beginning indices of each occurrence of the substring in the given string.
if (str.indexOf(substr) == -1) {
return new int[] {};
ArrayList<Integer> indexList = new ArrayList<Integer>();
String tempStr = str;
int prevAbsoluteIndex = 0;
while (tempStr.indexOf(substr) != -1) {
int index = tempStr.indexOf(substr);
...
Set
findAllSubsequences(String str)
find All Subsequences
if (str.equals("")) {
Set<String> subsequences = new HashSet<>();
subsequences.add(str);
return subsequences;
Set<String> subsequences = new HashSet<>();
char current = str.charAt(0);
str = new StringBuilder(str).deleteCharAt(0).toString();
...
String[]
findParam(String src, char patternFrom, char patternTo) return the parameter list.
ArrayList list = new ArrayList();
int i, j = 0, c = 0;
while (c < src.length()) {
i = src.indexOf(patternFrom, c);
if (i != -1) {
j = src.indexOf(patternTo, i + 1);
if (j != -1) {
list.add(src.substring(i, j + 1));
...
ResourceBundle
findResourceBundle(String aBundleName, Locale locale) Finds the given resorce bundle by it's name.
synchronized (misses) {
try {
if (!misses.contains(aBundleName)) {
return ResourceBundle.getBundle(aBundleName, locale,
Thread.currentThread().getContextClassLoader());
} catch (MissingResourceException ex) {
if (delegatedClassLoader != null) {
...
List
getAllOccurences(String str, char guess)
get All Occurences
List<Integer> occs = new ArrayList<>();
int index = str.indexOf(guess);
while (index >= 0) {
occs.add(index);
index = str.indexOf(guess, index + 1);
return occs;
List
getOccurenceIndices(String inSubject, String inOccurence)
get Occurence Indices
if (inSubject == null || inOccurence == null) {
return new ArrayList<Integer>(0);
final List<Integer> theOccurences = new ArrayList<Integer>();
int theLastIndex = 0;
while (inSubject.length() >= theLastIndex + inOccurence.length()) {
theLastIndex = inSubject.indexOf(inOccurence, theLastIndex);
if (theLastIndex < 0) {
...