
org.swiftsms.utils.HTMLParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common Show documentation
Show all versions of common Show documentation
Contains reusable platform independant code for all SwiftSMS client applications.
The newest version!
package org.swiftsms.utils;
public class HTMLParser {
/**
* This method is used to extract a piece of text from a String.
*
* @param html
* The larger String containing the text to be extracted.
* @param prefix
* A unique String that occurs directly before the sought text.
* @param postfix
* The String that occurs directly after the sought text.
* @return The String between the pre & post fix.
*/
public static String parseHtml(final String html, final String prefix, final String postfix) {
final int startPos = html.indexOf(prefix) + prefix.length();
final int endPos = html.indexOf(postfix, startPos);
String targetStr = null;
if (startPos > prefix.length()) {
targetStr = html.substring(startPos, endPos);
}
return targetStr;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy