ethan-brown2022 commented on code in PR #2836:
URL: https://github.com/apache/cassandra/pull/2836#discussion_r1376374820


##########
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:
   If the value ends on multiple "%", it will throw a `NumberFormatException`.  
This is the same result as any other string that cannot be parsed as a double, 
so I think it makes sense for this case as well.



-- 
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]

Reply via email to