List of usage examples for java.lang StringBuffer insert
@Override public synchronized StringBuffer insert(int dstOffset, CharSequence s, int start, int end)
From source file:Main.java
public static void main(String[] arg) { StringBuffer buffer = new StringBuffer("from java2s.com"); CharSequence cs = "java2s.com"; buffer.insert(2, cs, 1, 3); System.out.println(buffer);/* w w w. j av a 2 s .co m*/ }
From source file:Main.java
public static void main(String args[]) { StringBuffer buffer = new StringBuffer(); char charArray[] = { 'a', 'b', 'c', 'd', 'e', 'f' }; buffer.insert(0, charArray, 3, 3); System.out.println(buffer.toString()); }
From source file:NumberUtils.java
/** * Method to make specified length digit number string representation from particular * input number./* w w w .j a v a 2s .c om*/ * For example, if there will be send input number 32 and digit lenhth = 8, output * will be string '00000032' * * @param iInputNumber - input number that will be converted into 8 digit number * string representation * @param iDigitLength - length of the output digit number string * * @return String - digit number string representation */ public static String getDigitNumberString(int iInputNumber, int iDigitLength) { StringBuffer idString = new StringBuffer(Integer.toString(iInputNumber)); if (iDigitLength - idString.length() > 0) { idString.insert(0, ZEROCHARS, 0, iDigitLength - idString.length()); } return idString.toString(); }
From source file:org.jahia.services.applications.pluto.JahiaPortalURLParserImpl.java
private static void replaceChar(StringBuffer url, String character, String change) { boolean contains = url.toString().contains(character); while (contains) { int index = url.indexOf(character); url.deleteCharAt(index);// w w w . j av a2 s. c o m url.insert(index, change, 0, 3); contains = url.toString().contains(character); } }