Java tutorial
//package com.java2s; public class Main { public static int indexOfEnhanced(String src, String... strs) { for (String s : strs) { if (src.indexOf(s) != -1) return src.indexOf(s); } return -1; } public static int indexOfEnhanced(String src, int fromIndex, String... strs) { for (String s : strs) { if (src.indexOf(s, fromIndex) != -1) return src.indexOf(s); } return -1; } }