substringBetween
便利なものがあるもんだ
substringBetween public static java.lang.String substringBetween(java.lang.String str, java.lang.String open, java.lang.String close) Gets the String that is nested in between two Strings. Only the first match is returned. A null input String returns null. A null open/close returns null (no match). An empty ("") open and close returns an empty string. StringUtils.substringBetween("wx[b]yz", "[", "]") = "b" StringUtils.substringBetween(null, *, *) = null StringUtils.substringBetween(*, null, *) = null StringUtils.substringBetween(*, *, null) = null StringUtils.substringBetween("", "", "") = "" StringUtils.substringBetween("", "", "]") = null StringUtils.substringBetween("", "[", "]") = null StringUtils.substringBetween("yabcz", "", "") = "" StringUtils.substringBetween("yabcz", "y", "z") = "abc" StringUtils.substringBetween("yabczyabcz", "y", "z") = "abc" Parameters: str - the String containing the substring, may be null open - the String before the substring, may be null close - the String after the substring, may be null Returns: the substring, null if no match Since: 2.0