List of usage examples for java.lang StringBuilder replace
@Override public StringBuilder replace(int start, int end, String str)
From source file:org.apache.torque.generator.outlet.java.JavadocOutlet.java
/** * Wraps the content string such that the line length is not longer than * maxLineLength characters, if that can be achieved by wrapping at the * wrap characters. All resulting lines are also indented. * * @param content The content to wrap, may be null. * * @return the wrapped and indented content, not null. *///from w ww . j a v a 2 s.c o m String wrapLinesAndIndent(String content) { if (StringUtils.isBlank(content)) { return ""; } StringTokenizer tokenizer = new StringTokenizer(content.trim(), removableWrapCharacters + wrapAfterCharacters + "\r\n" + JAVADOC_ATTRIBUTE_START, true); StringBuilder result = new StringBuilder(); result.append(indent).append(MID_LINE_START); int currentLineLength = indent.length() + MID_LINE_START.length(); boolean lineBreakPossible = false; // last char is space so it can be removed boolean lastCharRemovable = true; String token = null; String currentIndent = indent + MID_LINE_START; String lastJavadocAttribute = null; while (tokenizer.hasMoreTokens() || token != null) { if (token == null) { // token has not been prefetched token = tokenizer.nextToken(); } if ("\r".equals(token)) { // Assumption: no \r without line breaks // always remove, will be added again if linebreak is \r\n token = null; } else if ("\n".equals(token)) { // line break does not count towards line length result.append(lineBreak); lineBreakPossible = false; // because currentIndent ends with a space // we can remove the last char lastCharRemovable = true; if (tokenizer.hasMoreTokens()) { result.append(currentIndent); currentLineLength = currentIndent.length(); } token = null; } else if (JAVADOC_ATTRIBUTE_START.equals(token)) { if (tokenizer.hasMoreTokens()) { token = tokenizer.nextToken(); // + 2 because of "@" + space after attribute currentIndent = StringUtils.rightPad(indent + MID_LINE_START, indent.length() + MID_LINE_START.length() + 2 + token.length()); if (result.length() > indent.length() + MID_LINE_START.length()) { // we could already be indented by a line break // in a previous param removeEnd(result, " \r\n"); boolean alreadyIndented = false; if (result.toString().endsWith(indent + " *")) { alreadyIndented = true; } boolean doubleLineBreak = false; if (!token.equals(lastJavadocAttribute)) { doubleLineBreak = true; } if (!alreadyIndented) { result.append(lineBreak).append(indent).append(" *"); } if (doubleLineBreak) { result.append(lineBreak).append(indent).append(" *"); } result.append(" "); } //+ 3 because " * " currentLineLength = indent.length() + MID_LINE_START.length(); lastJavadocAttribute = token; } result.append(JAVADOC_ATTRIBUTE_START); ++currentLineLength; lineBreakPossible = false; lastCharRemovable = false; } else if (maxLineLength == -1) { result.append(token); token = null; } else if (removableWrapCharacters.indexOf(token) != -1) { if (currentLineLength + 1 > maxLineLength) { result.append(lineBreak); if (tokenizer.hasMoreTokens()) { result.append(currentIndent); currentLineLength = currentIndent.length(); } lineBreakPossible = false; lastCharRemovable = false; } else { result.append(token); currentLineLength++; lineBreakPossible = true; lastCharRemovable = true; } token = null; } else if (lineBreakPossible) { // we must check next token String nextToken = null; if (tokenizer.hasMoreTokens()) { nextToken = tokenizer.nextToken(); } int unbreakableChunkSize; if (nextToken == null || "\r".equals(nextToken) || "\n".equals(nextToken) || wrapAfterCharacters.contains(token) || JAVADOC_ATTRIBUTE_START.equals(nextToken) || removableWrapCharacters.contains(nextToken)) { unbreakableChunkSize = token.length(); } else { unbreakableChunkSize = token.length() + nextToken.length(); } if (currentLineLength + unbreakableChunkSize > maxLineLength) { // break now if (lastCharRemovable) { result.replace(result.length() - 1, result.length(), ""); } result.append(lineBreak).append(currentIndent).append(token); currentLineLength = currentIndent.length() + token.length(); } else { // no break necessary result.append(token); currentLineLength += token.length(); } lastCharRemovable = false; lineBreakPossible = wrapAfterCharacters.contains(token); token = nextToken; } else { result.append(token); currentLineLength += token.length(); lastCharRemovable = false; lineBreakPossible = wrapAfterCharacters.contains(token); token = null; } } if (!result.toString().endsWith(lineBreak)) { result.append(lineBreak); } return result.toString(); }
From source file:rems.Global.java
public static String[] GetFileList(InetAddress ftpServerAddrs, String serverAppDirectory, String dirName, String userName, String password) { String[] downloadFiles = new String[1]; StringBuilder result = new StringBuilder(); FTPClient ftpClient = new FTPClient(); try {/* ww w. jav a 2 s. c o m*/ // pass directory path on server to connect ftpClient.connect(ftpServerAddrs); // pass username and password, returned true if authentication is // successful boolean login = ftpClient.login(userName, password); if (login) { //System.out.println("Connection established..."); // get all files from server and store them in an array of // FTPFiles FTPFile[] files = ftpClient.listFiles(); for (FTPFile file : files) { if (file.getType() == FTPFile.FILE_TYPE) { result.append(file.getName()); result.append("\n"); } } result.replace(result.toString().lastIndexOf("\n"), result.toString().length(), ""); // logout the user, returned true if logout successfully boolean logout = ftpClient.logout(); if (logout) { System.out.println("Connection close..."); } } else { System.out.println("Connection fail..."); } return result.toString().split("\\\n"); } catch (SocketException e) { Global.errorLog += Arrays.toString(e.getStackTrace()); Global.writeToLog(); } catch (IOException e) { Global.errorLog += Arrays.toString(e.getStackTrace()); Global.writeToLog(); } finally { try { ftpClient.disconnect(); } catch (IOException e) { Global.errorLog += Arrays.toString(e.getStackTrace()); Global.writeToLog(); } } return downloadFiles; }
From source file:com.quinsoft.epamms.ZGlobal1_Operation.java
private String ScrunchCamelCase(String s) { if (s.length() < 2) return s; if (s.charAt(0) == '(' && s.charAt(s.length() - 1) == ')') s = s.substring(1, s.length() - 1); String[] sub = s.split(" "); StringBuilder sb = new StringBuilder(); int k = 0;/*from www .ja v a 2s . c o m*/ while (k < sub.length) { if (sub[k].length() > 0 && (sub.length == 1 || (sub[k].compareToIgnoreCase("or") != 0 && sub[k].compareToIgnoreCase("and") != 0))) { sb.append(sub[k].substring(0, 1).toUpperCase()).append(sub[k].substring(1)); } k++; } k = sb.indexOf("PpmActive"); if (k >= 0) { sb.replace(k, k + 9, "PPM"); } return sb.toString(); }
From source file:com.quinsoft.zeidon.vml.VmlOperation.java
protected static final String zSearchAndReplace(String tgtString, int tgtLth, String searchString, String replaceString) {/*from ww w . j a v a2s . c o m*/ StringBuilder sb = new StringBuilder(tgtString); int position = sb.indexOf(searchString); while (position >= 0) { //sbString.replace( position, position + searchString.length( ) - 1, replaceString ); sb.replace(position, position + searchString.length(), replaceString); position = position + replaceString.length(); position = sb.indexOf(searchString, position); } return sb.toString(); }
From source file:com.quinsoft.zeidon.vml.VmlOperation.java
protected static final int zSearchAndReplace(StringBuilder sbString, int tgtLth, String searchString, String replaceString) {/* w w w. ja v a 2 s . c om*/ int position = sbString.indexOf(searchString); while (position >= 0) { //sbString.replace( position, position + searchString.length( ) - 1, replaceString ); sbString.replace(position, position + searchString.length(), replaceString); position = position + replaceString.length(); position = sbString.indexOf(searchString, position); } return sbString.length(); }
From source file:com.quinsoft.zencas.ZGLOBAL1_Operation.java
public int InsertOI_DataIntoTemplateFile(View view, View workView, String toFile, String fromFile, String stringRootEntityName) throws IOException { BufferedWriter bw;/* w ww . j a v a 2 s . c o m*/ StringBuilder sbInsertTemplate = new StringBuilder(); StringBuilder sbRawTemplate = new StringBuilder(); StringBuilder sbEntityBuffer; StringBuilder sbAttributeBuffer; String swapString = null; String stringStart = "{"; String stringEnd = "}"; int nRC = 0; int lSelectedCount = 0; int lTemplateLth = 0; nRC = SetCursorFirstEntity(workView, stringRootEntityName, ""); while (nRC > zCURSOR_UNCHANGED) { lSelectedCount++; nRC = SetCursorNextEntity(workView, stringRootEntityName, ""); } if (lSelectedCount <= 0) return 0; lTemplateLth = ReadFileDataIntoMemory(workView, fromFile, lTemplateLth, sbRawTemplate); if (lTemplateLth > Integer.MAX_VALUE) return 0; // File not found. if (lTemplateLth < 0) return -1; swapString = sbRawTemplate.substring(1, (lTemplateLth - 1)); lTemplateLth = swapString.length(); sbRawTemplate = new StringBuilder(); nRC = SetCursorFirstEntity(workView, stringRootEntityName, ""); while (nRC > zCURSOR_UNCHANGED) { sbRawTemplate.insert(0, swapString); for (int i = 0; i < sbRawTemplate.length(); i++) { sbEntityBuffer = new StringBuilder(); sbAttributeBuffer = new StringBuilder(); if (sbRawTemplate.charAt(i) == '[' && sbRawTemplate.charAt(i + 1) == 'Z') { int j = i; i += 2; while (sbRawTemplate.charAt(++i) != '.') sbEntityBuffer.append(sbRawTemplate.charAt(i)); while (sbRawTemplate.charAt(++i) != ']') sbAttributeBuffer.append(sbRawTemplate.charAt(i)); i++; sbRawTemplate.replace(j, i, GetStringFromAttribute(workView, sbEntityBuffer.toString(), sbAttributeBuffer.toString())); } } sbInsertTemplate.append(sbRawTemplate); sbRawTemplate = new StringBuilder(); nRC = SetCursorNextEntity(workView, stringRootEntityName, ""); } sbInsertTemplate.insert(0, stringStart); sbInsertTemplate.append(stringEnd); bw = new BufferedWriter(new FileWriter(toFile)); bw.write(sbInsertTemplate.toString()); bw.flush(); bw.close(); return 0; }
From source file:org.grible.servlets.ui.Home.java
/** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse * response)//from w w w. ja va 2s . c om */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); try { if (!GlobalSettings.getInstance().init(getServletContext().getRealPath(""))) { response.sendRedirect("/firstlaunch"); return; } StringBuilder responseHtml = new StringBuilder(); responseHtml.append("<!DOCTYPE html>"); responseHtml.append("<html>"); responseHtml.append("<head>"); responseHtml.append("<title>Grible</title>"); responseHtml.append("<link rel=\"shortcut icon\" href=\"img/favicon.ico\" >"); responseHtml.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"css/style.css\" />"); responseHtml .append("<link href=\"css/jquery.contextMenu.css\" rel=\"stylesheet\" type=\"text/css\" />"); responseHtml.append("<script type=\"text/javascript\" src=\"js/jquery-1.11.0.min.js\"></script>"); responseHtml.append("<script type=\"text/javascript\" src=\"js/jquery-ui.min.js\"></script>"); responseHtml.append("<script type=\"text/javascript\" src=\"lang/current.json\"></script>"); responseHtml.append("<script type=\"text/javascript\" src=\"js/home.js\"></script>"); responseHtml.append("<script type=\"text/javascript\" src=\"js/jquery.contextMenu.js\"></script>"); responseHtml.append("<script type=\"text/javascript\" src=\"js/noty/jquery.noty.js\"></script>"); responseHtml.append("<script type=\"text/javascript\" src=\"js/noty/top.js\"></script>"); responseHtml.append("<script type=\"text/javascript\" src=\"js/noty/defaultVarsHome.js\"></script>"); responseHtml.append("<script type=\"text/javascript\" src=\"js/noty/default.js\"></script>"); responseHtml.append("<script type=\"text/javascript\">"); responseHtml.append("var appType = \"") .append(GlobalSettings.getInstance().getAppType().toString().toLowerCase()).append("\";"); if (!isMultipleUsers()) { responseHtml.append("var productsWhosePathsNotExist = ").append(getProductsWhosePathsNotExist()) .append(";"); } else { responseHtml.append("var productsWhosePathsNotExist = [];"); } responseHtml.append("</script>"); responseHtml.append("</head>"); responseHtml.append("<body>"); if (isMultipleUsers() && request.getSession(false).getAttribute("userName") == null) { responseHtml.append("<div id=\"login-form\" class=\"table\">"); responseHtml.append("<div class=\"table-row\">"); responseHtml.append("<div id=\"login-grible-logo\" class=\"table-cell\">"); responseHtml.append("<img id=\"login-logo\" src=\"img/grible_logo.png\">"); responseHtml.append("</div>"); responseHtml.append("<div id=\"outer-credentials\" class=\"table-cell\">"); responseHtml.append("<form method=\"post\" action=\"Login\">"); responseHtml.append("<div id=\"credentials\" class=\"table\">"); responseHtml.append("<div class=\"table-row\">"); responseHtml.append("<div class=\"table-cell dialog-cell dialog-label\">"); responseHtml.append(Lang.get("username")); responseHtml.append(":</div>"); responseHtml.append("<div class=\"table-cell dialog-cell dialog-edit\">"); responseHtml.append("<input class=\"dialog-edit\" name=\"username\" style=\"width: 250px\"></div>"); responseHtml.append("</div>"); responseHtml.append("<div class=\"table-row\">"); responseHtml.append("<div class=\"table-cell dialog-cell dialog-label\">"); responseHtml.append(Lang.get("password")); responseHtml.append(":</div>"); responseHtml.append("<div class=\"table-cell dialog-cell dialog-edit\">"); responseHtml.append( "<input type=\"password\" class=\"dialog-edit\" name=\"pass\" style=\"width: 250px\"></div>"); responseHtml.append("</div>"); responseHtml.append("</div>"); if (request.getParameter("url") != null) { responseHtml.append( "<input type=\"hidden\" name=\"url\" value=\"" + request.getParameter("url") + "\">"); } responseHtml.append("<div class=\"login-dialog-buttons table\">"); responseHtml.append("<div class=\"table-row\">"); responseHtml.append("<div id=\"outer-dialog-error-message\" class=\"table-cell\">"); if (request.getSession(false).getAttribute("loginFailed") != null) { String message = (String) request.getSession(false).getAttribute("loginFailed"); responseHtml.append("<span class=\"dialog-error-message\">" + message + "</span>"); } responseHtml.append("</div>"); responseHtml.append("<div class=\"table-cell\">"); responseHtml.append("<script type=\"text/javascript\">document.write("); responseHtml.append("'<input type=\"submit\" value=\"'+ lang['login'] + '\" "); responseHtml.append("class=\"ui-button\">')</script>"); responseHtml.append("</div>"); responseHtml.append("</div>"); responseHtml.append("</div>"); responseHtml.append("</form>"); responseHtml.append("</div>"); responseHtml.append("</div>"); responseHtml.append("</div>"); } else { User user = null; if (isMultipleUsers()) { String userName = (String) request.getSession(false).getAttribute("userName"); user = new PostgresDao().getUserByName(userName); responseHtml.append(ServletHelper.getUserPanel(user)); } else { responseHtml.append(ServletHelper.getUserPanel()); } responseHtml.append("<div id=\"breadcrumb\" class=\"header-text\">"); responseHtml.append("<span id=\"home-image\"><img src=\"img/grible_logo_mini.png\"></span>"); responseHtml.append("<a href=\".\"><span id=\"home\">"); responseHtml.append(Lang.get("home")); responseHtml.append("</span></a>"); if (request.getParameter("product") != null) { if (StringUtils.isNumeric(request.getParameter("product"))) { int id = Integer.parseInt(request.getParameter("product")); Product product = DataManager.getInstance().getDao().getProduct(id); if (product != null) { responseHtml.replace(responseHtml.indexOf("id=\"home\">") + 9, responseHtml.indexOf("id=\"home\">") + 10, " class=\"link-infront\">"); responseHtml.append("<span class=\"extends-symbol\"> > </span>"); responseHtml.append("<a href=\"?product=" + id + "\"><span id=\"product-name\">"); responseHtml.append(product.getName()); responseHtml.append("</span></a></div>"); if (isMultipleUsers() && (!user.hasAccessToProduct(product.getId()))) { responseHtml.append("<br/><br/>"); responseHtml.append("<div class=\"error-message\">"); responseHtml.append(Lang.get("nopermissions") + "</div>"); } else { includeSections(responseHtml, product); } } else { response.sendRedirect("/"); } } else { response.sendRedirect("/"); } } else { responseHtml.append("</div>"); responseHtml.append("<div class=\"table\">"); List<Product> products = DataManager.getInstance().getDao().getProducts(); for (Product product : products) { if ((isMultipleUsers() && user.hasAccessToProduct(product.getId())) || (!isMultipleUsers())) { responseHtml.append("<div class=\"table-row\">"); responseHtml.append("<div class=\"table-cell section-cell\">"); responseHtml.append("<a href=\"?product=" + product.getId() + "\"><span id=\"" + product.getId() + "\" class=\"section product-item\">" + product.getName() + "</span></a>"); responseHtml.append("</div>"); responseHtml.append("</div>"); } } responseHtml.append("</div>"); if ((isMultipleUsers() && user.isAdmin()) || (!isMultipleUsers())) { responseHtml.append("<div class=\"under-sections\">"); responseHtml.append("<div class=\"icon-button button-enabled\" id=\"btn-add-product\">"); responseHtml.append("<img src=\"img/add-icon.png\" class=\"icon-enabled\">"); responseHtml.append( "<span class=\"icon-button-text\"> " + Lang.get("addproduct") + "</span></div>"); responseHtml.append("<p><img src=\"img/info-icon.png\"><span class=\"msg-text\">" + "<a href=\"#\" id=\"lnk-product-info\">" + Lang.get("whatisproduct") + "</a></span></p>"); responseHtml.append("</div>"); } responseHtml.append("<div id=\"video-tutorial-msg\">"); responseHtml.append("<img src=\"img/info-icon.png\"> "); responseHtml.append("<span class=\"msg-text\">" + Lang.get("newtogrible1")); responseHtml.append("<a href=\"http://www.grible.org/docs.php#video\" "); responseHtml.append("target=\"_blank\">" + Lang.get("video") + "</a>"); responseHtml.append(Lang.get("newtogrible2")); responseHtml.append("</span>"); responseHtml.append("</div>"); } responseHtml.append(ServletHelper.getFooter(getServletContext().getRealPath(""))); } responseHtml.append("</body>"); responseHtml.append("</html>"); out.print(responseHtml.toString()); } catch (Exception e) { e.printStackTrace(out); } finally { out.flush(); out.close(); } }
From source file:org.kuali.ole.select.document.OleOrderQueueDocument.java
/** * This method invokes approveDocument of DocumentService to approve selected requisitions * and sets errors appriopriately if approval fails. *//*from ww w .ja v a 2 s. c o m*/ public void massApprove() { LOG.debug("Inside massApprove of OleOrderQueueDocument"); ActionListService actionListSrv = KEWServiceLocator.getActionListService(); ActionRequestService actionReqSrv = KEWServiceLocator.getActionRequestService(); boolean orderQueue = false; boolean orderQueueNotApproved = false; WorkflowDocumentService workflowDocumentService = KRADServiceLocatorWeb.getWorkflowDocumentService(); Person person = SpringContext.getBean(PersonService.class) .getPerson(GlobalVariables.getUserSession().getPerson().getPrincipalId()); WorkflowDocument workflowDocument; String docNum = null; StringBuilder orderQueueRequisitionApproved = new StringBuilder(); StringBuilder orderQueueRequisitionNotApproved = new StringBuilder(); List<OleRequisitionItem> refreshItems = new ArrayList<OleRequisitionItem>(); for (OleRequisitionItem item : requisitionItems) { boolean itemAdded = item.isItemAdded(); if (itemAdded) { try { workflowDocument = workflowDocumentService .loadWorkflowDocument(item.getRequisition().getDocumentNumber(), person); if (workflowDocument.getInitiatorPrincipalId() .equals(GlobalVariables.getUserSession().getPerson().getPrincipalId())) { if (DocumentStatus.ENROUTE.equals(workflowDocument.getStatus())) { List<ActionRequestValue> actionReqValues = actionReqSrv .findAllPendingRequests(item.getRequisition().getDocumentNumber()); for (ActionRequestValue actionRequest : actionReqValues) { if (KewApiConstants.ACTION_REQUEST_APPROVE_REQ .equals(actionRequest.getActionRequested())) { Timestamp currentTime = SpringContext.getBean(DateTimeService.class) .getCurrentTimestamp(); List<ActionItem> actionItems = actionRequest.getActionItems(); for (ActionItem actionItem : actionItems) { if (KewApiConstants.ACTION_REQUEST_APPROVE_REQ_LABEL .equals(actionItem.getActionRequestLabel())) { actionItem.setPrincipalId( GlobalVariables.getUserSession().getPerson().getPrincipalId()); actionItem.setDateAssigned(currentTime); actionListSrv.saveActionItem(actionItem); } } actionRequest.setPrincipalId( GlobalVariables.getUserSession().getPerson().getPrincipalId()); actionRequest.setCreateDate(currentTime); actionReqSrv.saveActionRequest(actionRequest); boolean documentApproved = approveDocument( new Long(item.getRequisition().getPurapDocumentIdentifier()), item.getRequisition().getDocumentNumber(), actionRequest.getAnnotation()); if (!documentApproved) { refreshItems.add(item); } else { if (!item.getRequisition().getDocumentNumber().equalsIgnoreCase(docNum)) { orderQueueRequisitionApproved .append(item.getRequisition().getDocumentNumber()).append(","); orderQueue = true; docNum = item.getRequisition().getDocumentNumber(); } } } else { GlobalVariables.getMessageMap().putError(OLEConstants.OrderQueue.REQUISITIONS, OLEKeyConstants.ERROR_ORDERQUEUE_REQUISITIONS_NOAPPROVALS_REQD, new String[] { item.getRequisition().getDocumentNumber() }); refreshItems.add(item); } } } else if (workflowDocument.isSaved()) { boolean documentSubmitted = submitDocument( Long.valueOf(item.getRequisition().getPurapDocumentIdentifier()), item.getRequisition().getDocumentNumber(), OLEConstants.OrderQueue.SUBMIT_ANNOTATION); if (!documentSubmitted) { refreshItems.add(item); } else { orderQueueRequisitionApproved.append(item.getRequisition().getDocumentNumber()) .append(","); orderQueue = true; } } else { GlobalVariables.getMessageMap().putError(OLEConstants.OrderQueue.REQUISITIONS, OLEKeyConstants.ERROR_ORDERQUEUE_REQUISITIONS_APPROVE, new String[] { workflowDocument.getStatus().toString(), item.getRequisition().getDocumentNumber() }); refreshItems.add(item); } } else { orderQueueRequisitionNotApproved.append(item.getRequisition().getDocumentNumber()) .append(","); orderQueueNotApproved = true; } } catch (WorkflowException ex) { GlobalVariables.getMessageMap().putError(OLEConstants.OrderQueue.REQUISITIONS, RiceKeyConstants.ERROR_CUSTOM, ex.getMessage()); refreshItems.add(item); } } else { refreshItems.add(item); } } int len = orderQueueRequisitionApproved.lastIndexOf(","); if (orderQueue) { orderQueueRequisitionApproved.replace(len, len + 1, " "); GlobalVariables.getMessageMap().putInfo(OLEConstants.OrderQueue.REQUISITIONS, OLEKeyConstants.MESSAGE_ORDERQUEUE_REQUISITIONS_APPROVED, new String[] { orderQueueRequisitionApproved.toString() }); } int length = orderQueueRequisitionNotApproved.lastIndexOf(","); if (orderQueueNotApproved) { orderQueueRequisitionNotApproved.replace(length, length + 1, " "); GlobalVariables.getMessageMap().putError(OLEConstants.OrderQueue.REQUISITIONS, OLEKeyConstants.ERROR_ORDERQUEUE_REQUISITIONS_APPROVE_NOT_INITIATOR, new String[] { orderQueueRequisitionNotApproved.toString() }); } requisitionItems = refreshItems; LOG.debug("Leaving massApprove of OleOrderQueueDocument"); }
From source file:com.quinsoft.zeidon.vml.VmlOperation.java
protected String zReplaceSubString(String string, int nPosStart, int nPosEnd, String replaceString) { StringBuilder sb = new StringBuilder(string); sb.replace(nPosStart, nPosEnd, replaceString); return sb.toString(); }
From source file:com.quinsoft.zeidon.vml.VmlOperation.java
protected int zReplaceSubString(StringBuilder sb, int nPosStart, int nPosEnd, String replaceString) { sb.replace(nPosStart, nPosEnd, replaceString); return sb.length(); }