Search code examples
javastringsubstring

How to use StringUtils.substringsBetween();?


can someone demonstrate how to work with StringUtils.substringsBetween() method in java?


Solution

  • String foo = "<foo>foo</foo>";
    String bar = StringUtils.substringBetween(foo, "<foo>", "</foo>");
    

    The variable bar will have the String "foo".