Useful function to create a string with N copies of a same char
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@784 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
287bb52e81
commit
d261459c48
|
|
@ -381,6 +381,12 @@ public class Utils {
|
|||
public static double percentage(int x, int base) { return (base> 0 ? ((double)x/(double)base)*100.0 : 0); }
|
||||
public static double percentage(long x, long base) { return (base> 0 ? ((double)x/(double)base)*100.0 : 0); }
|
||||
|
||||
public static String dupString( char c, int nCopies ) {
|
||||
char[] chars = new char[nCopies];
|
||||
for ( int i = 0; i < nCopies; i++ ) chars[i] = c;
|
||||
//System.out.printf("chars is %s%n", new String(chars));
|
||||
return new String(chars);
|
||||
}
|
||||
|
||||
public static int countOccurances(char c, String s) {
|
||||
int count = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue