Here you can find the source of substringBeforeFirst(String string, String delimiter)
public static String substringBeforeFirst(String string, String delimiter)
//package com.java2s; //License from project: Apache License public class Main { public static String substringBeforeFirst(String string, String delimiter) {/*from w w w . j av a 2 s.co m*/ final int index = string.indexOf(delimiter); if (index == -1) { return ""; } return string.substring(0, index); } }