(Java) StringBuilder GetAfterBetween
Demonstrates the GetAfterBetween method.
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
CkStringBuilder sb = new CkStringBuilder();
sb.Append("<abc><person><name>Joe</name></person><company><name>Chilkat Software</name></company></abc>");
// The GetAfterBetween method gets the substring between two arbitrary marker strings, and doesn't
// start searching until the searchAfter string is passed.
// For example, to get the company name in the string above...
String searchAfter = "<company>";
String companyName = sb.getAfterBetween(searchAfter,"<name>","</name>");
System.out.println("Company Name = " + companyName);
}
}
|