List of usage examples for org.apache.commons.lang3 StringUtils substringBetween
public static String substringBetween(final String str, final String open, final String close)
Gets the String that is nested in between two Strings.
From source file:io.restassured.itest.java.support.RequestPathFromLogExtractor.java
public static String loggedRequestPathIn(StringWriter writer) { return StringUtils.substringBetween(writer.toString(), "Request URI:", "\n").trim(); }
From source file:com.jayway.restassured.itest.java.support.RequestPathFromLogExtractor.java
public static String loggedRequestPathIn(StringWriter writer) { return StringUtils.substringBetween(writer.toString(), "Request path:", "\n").trim(); }
From source file:com.ln.methods.Betaparser.java
public static void parse() { Timeconversion.convert();//w w w . j av a2s . co m source = source.replaceAll("\\s+\\n", " ").replaceAll("\\s+", " "); source = StringUtils.substringBetween(source, "<calendar>", "</calendar>"); source = source.replace("hour=\"", "<H>").replace("\" minute=\"", "</H><M>").replace("\" ov", "</M>") .replace("er=\"1\"", "<O>1</O").replace("er=\"0\"", "<O>0</O"); Monthnumbers = StringUtils.substringsBetween(source, "<month year=\"2012\" num=\"", "\">"); Temp = StringUtils.substringsBetween(source, "<event", "</event>"); for (int i = 0; i != Temp.length; i++) { source = source.replace("<month year=\"2012\" num=\"" + Monthnumbers[0] + "\">", "<mo>" + Monthnumbers[0] + "</mo>"); if (Monthnumbers.length > 1) { source = source .replace("<month year=\"2012\" num=\"" + Monthnumbers[1] + "\">", "<mo>" + Monthnumbers[1] + "</mo>") .replace("<day num=\"" + Integer.toString(i) + "\"><event ", "<D>" + Integer.toString(i) + "</D>"); } else if (Monthnumbers.length == 1) { source = source.replace("<day num=\"" + Integer.toString(i) + "\"><event ", "<D>" + Integer.toString(i) + "</D>"); } } Month1 = StringUtils.substringBetween(source, "<mo>" + Monthnumbers[0] + "</mo>", "</month>"); Month1 = Month1.replace("<D>", "@<D>"); Temp = StringUtils.substringsBetween(Month1, "@", "</day>"); if (Monthnumbers.length > 1) { Month2 = StringUtils.substringBetween(source, "<mo>" + Monthnumbers[1] + "</mo>", "</month>"); Month2 = Month2.replace("<D>", "@<D>"); Temp2 = StringUtils.substringsBetween(Month2, "@", "</day>"); } for (int i = 0; i != Temp.length; i++) { Temp[i] = Temp[i].replace("<H>", "<mo>" + Monthnumbers[0] + "</mo><D>" + StringUtils.substringBetween(Temp[i], "<D>", "</D>") + "</D><H>"); //Remove extra day tags Temp[i] = Temp[i].replace("<D>" + StringUtils.substringBetween(Temp[i], "<D>", "</D>") + "</D><D>", "<D>"); } Month1 = ArrayUtils.toString(Temp); if (Monthnumbers.length > 1) { for (int i = 0; i != Temp2.length; i++) { Temp2[i] = Temp2[i].replace("<H>", "<mo>" + Monthnumbers[1] + "</mo><D>" + StringUtils.substringBetween(Temp2[i], "<D>", "</D>") + "</D><H>"); //Remove extra day tags Temp2[i] = Temp2[i] .replace("<D>" + StringUtils.substringBetween(Temp2[i], "<D>", "</D>") + "</D><D>", "<D>"); } Month2 = ArrayUtils.toString(Temp2); source = StringUtils.join(Month1, Month2); } else { source = Month1; } for (int i = 0; i != 31; i++) { source = source.replace("<D>" + Integer.toString(i) + "</D><mo>", "<mo>"); } Days = StringUtils.substringsBetween(source, "<D>", "</D>"); Months = StringUtils.substringsBetween(source, "<mo>", "</mo>"); Hours = StringUtils.substringsBetween(source, "<H>", "</H>"); Minutes = StringUtils.substringsBetween(source, "<M>", "</M>"); Over = StringUtils.substringsBetween(source, "<O>", "</O>"); Title = StringUtils.substringsBetween(source, "<title>", "</title>"); STitle = StringUtils.substringsBetween(source, "<short-title>", "</short-title>"); Description = StringUtils.substringsBetween(source, "<description", "</description>"); ID = StringUtils.substringsBetween(source, "<event-id>", "</event-id>"); /*if (success(Months.length, Hours.length, Minutes.length, Over.length, Title.length, STitle.length, Description.length, ID.length)) { System.out.println("SUCCESS"); }else System.out.println("Something went wrong :("); */ int diff = Parser.hourd; for (int i = 0; i != Hours.length; i++) { Hours[i] = Integer.toString(Integer.parseInt(Hours[i]) - diff); } for (int i = 0; i != Hours.length; i++) { if (Integer.parseInt(Hours[i]) < 0) { Hours[i] = Integer.toString(Integer.parseInt(Hours[i]) + 24); Days[i] = Integer.toString(Integer.parseInt(Days[i]) - 1); } if (Integer.parseInt(Hours[i]) > 24) { Hours[i] = Integer.toString(Integer.parseInt(Hours[i]) - 24); Days[i] = Integer.toString(Integer.parseInt(Days[i]) + 1); } } for (int i = 0; i != Days.length; i++) { Daysint[i] = Integer.parseInt(Days[i]); } for (int i = 0; i != Daysint.length; i++) { if (Daysint[i] == i) { DD[i]++; } } for (int i = 0; i != Title.length; i++) { if (Integer.parseInt(Days[i]) <= 0) { Months[i] = Integer.toString(Integer.parseInt(Months[i]) - 1); Days[i] = Integer.toString(Integer.parseInt(Days[i] + 31)); } } for (int i = 0; i != Title.length; i++) { Events[i] = Months[i] + "|" + Days[i] + "|" + Hours[i] + "|" + Title[i] + "|" + STitle[i] + "|" + Description[i]; } }
From source file:jclparser.model.CARD_IKJEFT01.java
@Override public void parse() { System.out.println("Parsing..." + this); List<String> text = member.getText(); String pgm = ""; for (String line : text) { Matcher m = Pattern.compile("PROGRAM\\(\\w+\\)").matcher(line); if (m.find()) { program = StringUtils.substringBetween(m.group(), "(", ")"); }//from w ww .j ava 2s. c o m m = Pattern.compile("PLAN\\(\\w+\\)").matcher(line); if (m.find()) { plan = StringUtils.substringBetween(m.group(), "(", ")"); } } }
From source file:ch.sbb.releasetrain.utils.mavenserach.LatetVersionFromMavenserach.java
public String getLatestVersionForGroupId(String group) { String ret = util//from w w w . j a v a2s . c om .getPageAsString("http://search.maven.org/solrsearch/select?q=g:%22" + group + "%22&rows=1&wt=xml"); return StringUtils.substringBetween(ret, "<str name=\"latestVersion\">", "</str>"); }
From source file:kenh.expl.functions.SubstringBetween.java
public String process(String str, String open, String close) { return StringUtils.substringBetween(str, open, close); }
From source file:com.ibm.watson.apis.conversation_enhanced.filters.LookUp.java
public String lookUpQuickQuote(String stockSymbol) throws HttpException, IOException { String url = "http://ws.cdyne.com/delayedstockquote/delayedstockquote.asmx/GetQuickQuote?StockSymbol=" + stockSymbol + "&LicenseKey=0"; return StringUtils.substringBetween(sendGetRequest(url), "<decimal xmlns=\"http://ws.cdyne.com/\">", "</decimal>"); }
From source file:com.cognifide.bdd.demo.po.touchui.ImageComponent.java
public String getImagePath() { return StringUtils.substringBetween(getImgScript(), "imageAsset: \"", "\""); }
From source file:com.willwinder.universalgcodesender.connection.JSerialCommConnection.java
@Override public void setUri(String uri) { try {// w w w.j a va 2 s .c o m String portName = StringUtils.substringBetween(uri, ConnectionDriver.JSERIALCOMM.getProtocol(), ":"); int baudRate = Integer.valueOf(StringUtils.substringAfterLast(uri, ":")); initSerialPort(portName, baudRate); } catch (Exception e) { throw new ConnectionException("Couldn't parse connection string " + uri, e); } }
From source file:com.willwinder.universalgcodesender.connection.JSSCConnection.java
@Override public void setUri(String uri) { try {// w ww. j a v a 2 s . c o m portName = StringUtils.substringBetween(uri, ConnectionDriver.JSSC.getProtocol(), ":"); baudRate = Integer.valueOf(StringUtils.substringAfterLast(uri, ":")); } catch (Exception e) { throw new ConnectionException("Couldn't parse connection string " + uri, e); } }