/*******************************************************************************
* Copyright (c) 2016 Boeing.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.xviewer.core.util;
import java.util.Random;
/**
* @author Donald G. Dunne
*/
public class XViewerUtil {
static Random random = new Random();
public static String intern(String str) {
return (str == null) ? null : str.intern();
}
public static String doubleToI18nString(double d) {
return doubleToI18nString(d, false);
}
public static String doubleToI18nString(double d, boolean blankIfZero) {
if (blankIfZero && d == 0) {
return "";
} else {
return String.format("%4.2f", d);
}
}
public static String generateGuidStr() {
long rand = (random.nextLong() & 0x7FFFFFFFFFFFFFFFL) | 0x4000000000000000L;
return Long.toString(rand, 32) + Long.toString(System.currentTimeMillis() & 0xFFFFFFFFFFFFFL, 32);
}
}