Here you can find the source of extractJobId(String line)
public static String extractJobId(String line)
//package com.java2s; //License from project: GNU General Public License import java.util.Arrays; import java.util.List; public class Main { private static final List<Character> jobIdChars = Arrays.asList('_', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'); public static String extractJobId(String line) { if (line.contains("job_201")) { int start = line.indexOf("job_201"); int end = start; for (int i = start + 7; i < line.length(); i++) { if (jobIdChars.contains(line.charAt(i))) { end = i;//from w w w. j av a 2 s .c o m } else { break; } } String job = line.substring(start, end + 1); return job; } return null; } }