Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adicionar método fillWithSpaces(String, int) à classe StringUtils.

  • Loading branch information...
commit 9583f443d4cf2f3202b2b1d08718c262ef96a31b 1 parent f5dcdb9
@quagliato authored
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/quagliato/prog2/util/StringUtils.java
View
10 src/quagliato/prog2/util/StringUtils.java
@@ -15,6 +15,14 @@ public static String repeat(char c, int size) {
result = result + c;
}
return result;
-
+ }
+
+ public static String fillWithSpaces(String s, int size) {
+ if (size == 0 || size < s.length())
+ return s;
+
+ String result = s + StringUtils.repeat(' ', size - s.length());
+
+ return result;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.