-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove trailing zeros from coordinates #424
Conversation
@@ -27,24 +28,27 @@ | |||
* @since 1.0.0 | |||
*/ | |||
private Position(double longitude, double latitude, double altitude) { | |||
// Used to remove any trailing zeros and prevent a coordinate being over 7 significant figures. | |||
DecimalFormat decimalFormat = new DecimalFormat("0.######"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this same logic is used in several place, how about exposing it as static utility method?
@@ -47,4 +51,10 @@ public static String join(CharSequence delimiter, Object[] tokens) { | |||
return sb.toString(); | |||
} | |||
|
|||
public static String formatCoordinate(double coordinate) { | |||
// Used to remove any trailing zeros and prevent a coordinate being over 7 significant figures. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cammace Let's make it a javadoc instead.
public static String formatCoordinate(double coordinate) { | ||
// Used to remove any trailing zeros and prevent a coordinate being over 7 significant figures. | ||
DecimalFormat decimalFormat = new DecimalFormat("0.######", new DecimalFormatSymbols(Locale.US)); | ||
return String.format(Locale.US, "%s", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cammace We have a constant for the default locale already.
closes #338