Repeat a string: Difference between revisions

Content added Content deleted
(→‎{{header|Java}}: no functions in Java)
Line 458: Line 458:
{{works with|Java|1.5+}}
{{works with|Java|1.5+}}


There's no function or operator to do this in Java, so you have to do it yourself.
There's no method or operator to do this in Java, so you have to do it yourself.
<lang java5>public static String repeat(String str, int times){
<lang java5>public static String repeat(String str, int times){
StringBuilder ret = new StringBuilder();
StringBuilder ret = new StringBuilder();