Java String Sub String substringBetween(String str, String pos1, String pos2)

Here you can find the source of substringBetween(String str, String pos1, String pos2)

Description

substring Between

License

Open Source License

Declaration

public static final String substringBetween(String str, String pos1, String pos2) 

Method Source Code

//package com.java2s;
/*//  w w w .j av  a  2 s  .co  m
 * Copyright 2005-2020 GreenTube Team All rights reserved.
 * Support: Huxg
 * License: CND team license
 */

public class Main {
    public static final String substringBetween(String str, String pos1, String pos2) {
        int p1 = str.indexOf(pos1);
        String sub = str.substring(p1 + pos1.length());

        int p2 = sub.indexOf(pos2);
        sub = sub.substring(0, p2);
        return sub;
    }
}

Related

  1. substringBetween(String str, String before, String after)
  2. substringBetween(String str, String open, String close)
  3. substringBetween(String str, String open, String close)
  4. substringBetween(String str, String open, String close)
  5. substringBetween(String str, String open, String close, int fromIndex)
  6. substringBetween(String str, String tag)
  7. substringBetween(String str, String tag)
  8. substringBetweenStrings(String within, String pre, String post)
  9. subStringByByte(String orignal, int subcount)