Skip to content

Commit

Permalink
Java: Add missed parse() overload.
Browse files Browse the repository at this point in the history
  • Loading branch information
agdavydov81 committed Sep 25, 2023
1 parent d34bb28 commit eeb3ae9
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion java/dfp/src/main/java/com/epam/deltix/dfp/Decimal64.java
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,29 @@ public static Decimal64 parse(final CharSequence text, final int startIndex) {
* @throws NumberFormatException if {@code text} does not contain valid dfp floating value.
*/
public static Decimal64 parse(final CharSequence text) {
return Decimal64.fromUnderlying(Decimal64Utils.parse(text, 0, text.length()));
return Decimal64.fromUnderlying(Decimal64Utils.parse(text));
}

/**
* Parses a dfp floating-point value from the given textual representation.
* <p>
* Besides regular floating-point values (possibly in scientific notation) the following special cases are accepted:
* <ul>
* <li>{@code +Inf}, {@code Inf}, {@code +Infinity}, {@code Infinity} in any character case result in
* {@code Decimal64Utils.POSITIVE_INFINITY}</li>
* <li>{@code -Inf}, {@code -Infinity} in any character case result in
* {@code Decimal64Utils.NEGATIVE_INFINITY}</li>
* <li>{@code +NaN}, {@code -NaN}, {@code NaN} in any character case result in
* {@code Decimal64Utils.NaN}</li>
* </ul>
*
* @param text Textual representation of dfp floating-point value.
* @param decimalMarks A decimal separators used to separate the integer part from the fractional part.
* @return 64-bit dfp floating-point.
* @throws NumberFormatException if {@code text} does not contain valid dfp floating value.
*/
public static Decimal64 parse(final CharSequence text, final String decimalMarks) {
return Decimal64.fromUnderlying(Decimal64Utils.parse(text, decimalMarks));
}

/**
Expand Down

0 comments on commit eeb3ae9

Please sign in to comment.