Java String Sub String substringInBetween(String name, String prefix, String delimiter)

Here you can find the source of substringInBetween(String name, String prefix, String delimiter)

Description

substring In Between

License

Apache License

Declaration

public static String substringInBetween(String name, String prefix,
            String delimiter) 

Method Source Code

//package com.java2s;
// Licensed to the Apache Software Foundation (ASF) under one

public class Main {
    public static String substringInBetween(String name, String prefix,
            String delimiter) {/*  w  w  w  . j a  va 2s.co m*/

        int startPos = 0;
        if (prefix != null)
            startPos = prefix.length() + 1;

        int endPos = name.indexOf(delimiter, startPos);
        if (endPos > 0)
            return name.substring(startPos, endPos);

        return null;
    }
}

Related

  1. subStringExe(String s, String jmp, String sb, String se)
  2. substringFromMatch(String match, String string)
  3. substringFromMultiValuedFields(int start, int end, String[] fieldValues, int offsetGap, String interFieldJoiner)
  4. substringGuarded(String s, int position, int count)
  5. subStringIgnoreCase(String str, String separator, Integer stratNum, Integer endNum)
  6. substringL(String s, int i, int len)
  7. substringLinesWithTokenOfEOL( String originalString, String stringToBeInserted)
  8. substringMatch(CharSequence str, int index, CharSequence substring)
  9. substringMatch(CharSequence str, int index, CharSequence substring)