Here you can find the source of safeIndexOf(String s, String search)
public static int safeIndexOf(String s, String search)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); public class Main { public static int safeIndexOf(String s, String search) { final int i = s.indexOf(search); if (i == -1) { return s.length(); }/*ww w.j a va 2 s . c o m*/ return i; } }