src/main/java/de/uapcore/lightpit/Functions.java

changeset 131
67df332e3146
parent 78
bb4c52bf3439
--- a/src/main/java/de/uapcore/lightpit/Functions.java	Thu Oct 15 18:36:05 2020 +0200
+++ b/src/main/java/de/uapcore/lightpit/Functions.java	Thu Oct 15 20:02:30 2020 +0200
@@ -74,6 +74,14 @@
         return req.getServletPath() + Optional.ofNullable(req.getPathInfo()).orElse("");
     }
 
+    public static int parseIntOrZero(String str) {
+        try {
+            return Integer.parseInt(str);
+        } catch (NumberFormatException ex) {
+            return 0;
+        }
+    }
+
     /**
      * This class is not instantiatable.
      */

mercurial