Java String Sub String substringBetweenStrings(String within, String pre, String post)

Here you can find the source of substringBetweenStrings(String within, String pre, String post)

Description

substring Between Strings

License

Open Source License

Declaration

public static String substringBetweenStrings(String within, String pre, String post) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String substringBetweenStrings(String within, String pre, String post) {
        int from = within.indexOf(pre);
        if (from < 0)
            return null;
        from += pre.length();//w w  w  .j  a va2 s  . c  o  m
        int to = within.indexOf(post, from);
        if (to < 0)
            return null;
        return within.substring(from, to);
    }
}

Related

  1. substringBetween(String str, String open, String close)
  2. substringBetween(String str, String open, String close, int fromIndex)
  3. substringBetween(String str, String pos1, String pos2)
  4. substringBetween(String str, String tag)
  5. substringBetween(String str, String tag)
  6. subStringByByte(String orignal, int subcount)
  7. subStringByByte(String str, int byteLenth)
  8. substringByByteCount(String str, int byteCount)
  9. subStringByBytes(String str, int toCount, String more)