Merge pull request #9792 from symptog/v2.2.x-release

Fix missing leading zeros in conference number for 2.2.x
This commit is contained in:
Anton Georgiev 2020-07-10 11:31:32 -04:00 committed by GitHub
commit ebb80f3285
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,15 +119,15 @@ public class ParamsProcessorUtil {
private String formatConfNum(String s) {
if (s.length() > 5) {
Long confNumL = Long.parseLong(s);
Locale numFormatLocale = new Locale("en", "US");
String formatPattern = "#,###";
DecimalFormatSymbols unusualSymbols = new DecimalFormatSymbols(numFormatLocale);
unusualSymbols.setGroupingSeparator(' ');
DecimalFormat numFormatter = new DecimalFormat(formatPattern, unusualSymbols);
numFormatter.setGroupingSize(3);
return numFormatter.format(confNumL);
/* Reverse conference number.
* Put a whitespace every third char.
* Reverse it again to display it correctly.
* Trim leading whitespaces.
* */
String confNumReversed = new StringBuilder(s).reverse().toString();
String confNumSplit = confNumReversed.replaceAll("(.{3})", "$1 ");
String confNumL = new StringBuilder(confNumSplit).reverse().toString().trim();
return confNumL;
}
return s;