Java String Sub String substringBeforeFirst(String string, String delimiter)

Here you can find the source of substringBeforeFirst(String string, String delimiter)

Description

substring Before First

License

Apache License

Declaration

public static String substringBeforeFirst(String string,
            String delimiter) 

Method Source Code

//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);
    }
}

Related

  1. substringBefore(String str, String separator)
  2. substringBefore(String str, String separator)
  3. substringBefore(String string, String delimiter)
  4. substringBefore(String text, String str)
  5. substringBeforeChar(String str, int separator)
  6. subStringBeforeFirstTab(final String s)
  7. substringBeforeLast(final String str, final String separator)
  8. substringBeforeLast(String str, String separator)
  9. substringBeforeLast(String str, String separator)