List of usage examples for java.lang StringBuilder deleteCharAt
@Override public StringBuilder deleteCharAt(int index)
From source file:hr.fer.zemris.vhdllab.service.hierarchy.HierarchyNode.java
@Override public String toString() { StringBuilder sb = new StringBuilder((dependencies.size() + 1) * 15); sb.append(file.getName()).append(" ["); for (File dep : dependencies) { sb.append(dep.getName()).append(","); }/*from w w w.j a v a2s . c o m*/ if (!dependencies.isEmpty()) { sb.deleteCharAt(sb.length() - 1); } sb.append("]"); return sb.toString(); }
From source file:com.appeligo.search.actions.network.RecommendProgramAction.java
private String generateLink(Program program) { Configuration configuration = ConfigUtils.getSystemConfig(); StringBuilder link = new StringBuilder(); String url = configuration.getString("url"); link.append(url);//from w w w .jav a 2 s .c o m if (url.endsWith("/")) { link.deleteCharAt(link.length() - 1); } if (showOnly) { link.append(program.getShowWebPath()); } else { link.append(program.getWebPath()); } return link.toString(); }
From source file:net.freechoice.dao.impl.DaoTemplate.java
public final String bracketPostIdnTagIds(final int postId, final List<Integer> ls) { StringBuilder builder = new StringBuilder(64); final String id1 = String.valueOf(postId); for (Integer v : ls) { builder.append("(" + v + "," + id1 + "),"); }/* ww w . ja v a 2s.c o m*/ builder.deleteCharAt(builder.lastIndexOf(",")); return builder.toString(); }
From source file:com.arkea.jenkins.openstack.heat.orchestration.template.Bundle.java
/** * Convert an object value from the yaml to string * //from w w w . j a v a2 s .co m * @param value * the object value from the yaml * @return the object in string format */ @SuppressWarnings("unchecked") private String convertValue(Object value) { if (value instanceof java.util.LinkedHashMap) { StringBuilder rtn = new StringBuilder("{"); java.util.LinkedHashMap<String, String> data = (java.util.LinkedHashMap<String, String>) value; for (String key : data.keySet()) { rtn.append(key).append(":").append(data.get(key)).append(","); } rtn.deleteCharAt(rtn.length() - 1); rtn.append("}"); return rtn.toString(); } return String.valueOf(value); }
From source file:com.heliosapm.tsdblite.metric.Metric.java
/** * Renders the tags in a simple map format * @return the rendered map//from w w w .j a va 2s .co m */ public String tagsToStr() { final StringBuilder b = new StringBuilder(); for (Map.Entry<String, String> entry : tags.entrySet()) { b.append(entry.getKey()).append("=").append(entry.getValue()).append(","); } return b.deleteCharAt(b.length() - 1).toString(); }
From source file:com.sk89q.bukkit.util.DynamicPluginCommand.java
@Override public java.util.List<String> tabComplete(CommandSender sender, String alias, String[] args) throws CommandException, IllegalArgumentException { Validate.notNull(sender, "Sender cannot be null"); Validate.notNull(args, "Arguments cannot be null"); Validate.notNull(alias, "Alias cannot be null"); List<String> completions = null; try {// w w w .j a va 2 s . com if (completer != null) { completions = completer.onTabComplete(sender, this, alias, args); } if (completions == null && owner instanceof TabCompleter) { completions = ((TabCompleter) owner).onTabComplete(sender, this, alias, args); } } catch (Throwable ex) { StringBuilder message = new StringBuilder(); message.append("Unhandled exception during tab completion for command '/").append(alias).append(' '); for (String arg : args) { message.append(arg).append(' '); } message.deleteCharAt(message.length() - 1).append("' in plugin ") .append(owningPlugin.getDescription().getFullName()); throw new CommandException(message.toString(), ex); } if (completions == null) { return super.tabComplete(sender, alias, args); } return completions; }
From source file:ch.iceage.icedms.persistence.jdbc.query.AbstractGenericQueries.java
@Override public String update(String tableName, Map<String, String> values, Long key) { StringBuilder sb = new StringBuilder(); sb.append("UPDATE ").append(tableName).append(" "); for (String columnName : values.keySet()) { sb.append("SET ").append(columnName).append("=").append(values.get(columnName)).append(","); }//w ww .j a v a 2 s . c o m sb.deleteCharAt(sb.length() - 2).append(" "); sb.append("WHERE id = ").append(key); return sb.toString(); }
From source file:net.freechoice.dao.impl.DaoTemplate.java
public final <E extends FC_Model> String bracketPostnTags(final FC_Post post, final List<E> ls) { StringBuilder builder = new StringBuilder(64); final String id1 = String.valueOf(post.getId()); for (E v : ls) { builder.append("(" + v.getId() + "," + id1 + "),"); }//from w w w . ja v a2 s .c o m builder.deleteCharAt(builder.lastIndexOf(",")); return builder.toString(); }
From source file:test.other.T_DaoTest.java
public void test() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, InstantiationException { FC_Tag tag = new FC_Tag(); tag.content = "content"; // mapper.mapToTable(get, tag); String namString = (String) FC_User.class.getField("TABLE_NAME").get(FC_User.class.newInstance()); System.out.println(namString + '\n' + (String) FC_User.class.getField("TABLE_NAME").toString()); // //from ww w .j av a2s. c o m List<Integer> taIds = new ArrayList<Integer>(); taIds.add(1); taIds.add(34); taIds.add(45); taIds.add(11); taIds.add(15); taIds.add(1556756867); taIds.add(25476991); // StringBuilder sBuilder = new StringBuilder("("); // // for (Integer v_Tag : taIds) { // sBuilder.append(v_Tag).append(','); // } // sBuilder.setCharAt(sBuilder.lastIndexOf(","), ')'); // System.out.println(sBuilder.toString()); StringBuilder sBuilder = new StringBuilder(); final String postId = String.valueOf(999); for (Integer v_Tag : taIds) { sBuilder.append("( " + postId + ", " + v_Tag + "),"); } sBuilder.deleteCharAt(sBuilder.lastIndexOf(",")); System.out.println("insert into r_tag_post(id_post_, id_tag_)values" + sBuilder.toString()); }
From source file:com.flipkart.poseidon.internal.ParamValidationFilter.java
private String getGreedyPathParam(int start, int end, String[] url) { StringBuilder builder = new StringBuilder(); for (int i = start; i < end; i++) { builder.append(url[i]).append("/"); }/*from w w w. java2 s . co m*/ builder.deleteCharAt(builder.length() - 1); return builder.toString(); }