- /**
- * Method to PrePend String
- */
- publicString prependString(String source, String pad, int length)
- {
- if(source ==null)
- {
- returnnull;
- }
- if(pad ==null)
- {
- return source;
- }
- StringBuffer result =newStringBuffer();
- result.append(source);
- while(result.length()< length)
- {
- result.insert(0, pad);
- }
- return result.toString();
- }
↧
Write a prepend String function in Java?
↧