List of utility methods to do String Multiply
String | multiply(final CharSequence str, final int factor) multiply if (factor < 0) throw new IllegalArgumentException(); final StringBuilder sb = new StringBuilder(); for (int i = 0; i < factor; i++) sb.append(str); return sb.toString(); |
String | multiply(final String s, final Long factor) multiply final int factorInt = factor.intValue(); if (factor == 0) return ""; if (factor == 1) return s; final StringBuilder sb = new StringBuilder(s.length() * factorInt); for (int i = 0; i < factorInt; ++i) { sb.append(s); ... |
String | multiply(final String string, final int times) multiply if (times < 0) { throw new IllegalArgumentException(); if (times == 0) { return ""; final StringBuilder builder = new StringBuilder(string.length() * times); for (int i = 0; i < times; i++) { ... |
String | multiply(String original, int times) multiply String s = ""; for (int i = 0; i < times; i++) { s += original; return s; |
String | multiply(String self, int reps) reps repitions of self StringBuffer buf = new StringBuffer(self.length() * reps); for (int i = 0; i < reps; i++) { buf.append(self); return buf.toString(); |
String | multiply(String str11, String str22) multiply String result = "0"; String str1 = str11.replace(".", ""); String str2 = str22.replace(".", ""); if (str1.length() > str2.length()) { str2 = compare1(str1, str2); } else if (str1.length() < str2.length()) { str1 = compare1(str2, str1); char[] ch1 = new char[str1.length()]; reverse(str1, ch1); char[] ch2 = new char[str2.length()]; reverse(str2, ch2); String[] res = new String[ch1.length * ch1.length]; int r = 0; for (int i = 0; i < ch1.length; i++) { for (int j = 0; j < ch2.length; j++) { res[r] = String.valueOf(morePlus(ch1[i] - '0', ch2[j] - '0')); for (int k = 0; k <= i + j; k++) { if (k > 0) { res[r] = res[r] + "0"; if (r < res.length) { r++; for (String s : res) { result = sum(result, s); int index0 = -1; for (int i = 0; i < result.length(); i++) { if (result.charAt(0) == '0') if (result.charAt(i) == '0' && result.charAt(i + 1) != '0') { index0 = i; if (index0 != -1) { result = result.substring(index0 + 1); int index = 0; if (str11.contains(".") || str22.contains(".")) { int index1 = str11.indexOf("."); int len1 = str11.length() - 1 - index1; int index2 = str22.indexOf("."); int len2 = str22.length() - 1 - index2; index = result.length() - (len1 + len2); StringBuilder ss = new StringBuilder(result); ss.insert(index, "."); result = ss.toString(); return result; |
String | multiplyString(String s, int count) multiply String final StringBuilder ret = new StringBuilder(); for (int i = 0; i < count; i++) { ret.append(s); return ret.toString(); |
String | multiplyString(String sourceStr, int count) "Multiply" a String, i.e. String outStr = ""; for (int i = 0; i < count; i++) { outStr += sourceStr; return outStr; |
String | multiplyStringWithInt(String strMultiplicand, int multiplier) multiply String With Int return Integer.toString(Integer.parseInt(strMultiplicand) * multiplier);
|