asn1s-api/src/main/java/org/asn1s/api/util/NRxUtils.java
/**
	 * Converts value to canonical NR3 ISO 6093 form
	 *
	 * @param value the value to convert, may be NR1, NR2, NR3 ISO 6093 form
	 * @return string
	 */
Converts value to canonical NR3 ISO 6093 form
@param value the value to convert, may be NR1, NR2, NR3 ISO 6093 form
@return string
Converts value to canonical NR3 ISO 6093 form @param value the value to convert may be NR1 NR2 NR3 ISO 6093 form @return string
public static String toCanonicalNR3( String value )
	{
		if( "-Infinity".equals( value ) || "Infinity".equals( value ) || "NaN".equals( value ) )
			return value;
		if( !FORMAT_PATTERN.matcher( value ).matches() )
			throw new IllegalArgumentException();
		value = value.toUpperCase();
		String mantisStr;
		String exponentStr;
		int expIndex = value.indexOf( 'E' );
		if( expIndex == -1 )
		{
			mantisStr = value;
			exponentStr = "0";
		}
		else
		{
			mantisStr = value.substring( 0, expIndex ).trim();
			exponentStr = value.substring( expIndex + 1 ).trim();
		}
		int scale;
		String actualMantis;
		int dotIndex = mantisStr.indexOf( '.' );
		if( dotIndex == -1 )
		{
			scale = 0;
			actualMantis = mantisStr;
		}
		else
		{
			scale = mantisStr.length() - dotIndex - 1;
			String fracture = mantisStr.substring( dotIndex + 1 );
			if( isAllZeros( fracture ) )
			{
				scale -= fracture.length();
				fracture = "";
			}
			actualMantis = mantisStr.substring( 0, dotIndex ) + fracture;
		}
		return formatInt( actualMantis ) + ".E" + formatExponent( scale, exponentStr );
	}
public static String toCanonicalNR3 ( String value ) { if ( "-Infinity" . equals ( value ) || "Infinity" . equals ( value ) || "NaN" . equals ( value ) ) return value ; if ( ! FORMAT_PATTERN . matcher ( value ) . matches ( ) ) throw new IllegalArgumentException ( ) ; value = value . toUpperCase ( ) ; String mantisStr ; String exponentStr ; int expIndex = value . indexOf ( 'E' ) ; if ( expIndex == - 1 ) { mantisStr = value ; exponentStr = "0" ; } else { mantisStr = value . substring ( 0 , expIndex ) . trim ( ) ; exponentStr = value . substring ( expIndex + 1 ) . trim ( ) ; } int scale ; String actualMantis ; int dotIndex = mantisStr . indexOf ( '.' ) ; if ( dotIndex == - 1 ) { scale = 0 ; actualMantis = mantisStr ; } else { scale = mantisStr . length ( ) - dotIndex - 1 ; String fracture = mantisStr . substring ( dotIndex + 1 ) ; if ( isAllZeros ( fracture ) ) { scale -= fracture . length ( ) ; fracture = "" ; } actualMantis = mantisStr . substring ( 0 , dotIndex ) + fracture ; } return formatInt ( actualMantis ) + ".E" + formatExponent ( scale , exponentStr ) ; }
Converts value to canonical NR3 ISO 6093 form
 @param value the value to convert, may be NR1, NR2, NR3 ISO 6093 form
 @return string
Converts value to canonical NR3 ISO 6093 form @param value the value to convert may be NR1 NR2 NR3 ISO 6093 form @return string
// no exponent in source