smiklosovic commented on code in PR #2836:
URL: https://github.com/apache/cassandra/pull/2836#discussion_r1376058986
##########
src/java/org/apache/cassandra/utils/FBUtilities.java:
##########
@@ -1030,6 +1030,22 @@ public static long parseHumanReadableBytes(String value)
return (long) parseHumanReadable(value, null, "B");
}
+ /**
+ * Parse a double where both a direct value and a percentage are accepted.
+ * For example, for inputs "0.1" and "10%", this function will return 0.1.
+ */
+ public static double parsePercent(String value)
+ {
+ value = value.trim();
+ if (value.endsWith("%"))
Review Comment:
@ethan-brown2022 what if the value ends on multiple "%" like this? "0.1%%%"?
Then you will try to parse "0.1%%". It is questionable if we want to do
something with it though.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]