From c695d05a5f7144e54d257133b73b1554d42d8fad Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 22 Sep 2014 23:58:01 +0200 Subject: [PATCH] Added a fast search in a string for a char method --- Dorkbox-Util/src/dorkbox/util/Sys.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Dorkbox-Util/src/dorkbox/util/Sys.java b/Dorkbox-Util/src/dorkbox/util/Sys.java index 2160ba0..2e0e414 100644 --- a/Dorkbox-Util/src/dorkbox/util/Sys.java +++ b/Dorkbox-Util/src/dorkbox/util/Sys.java @@ -122,6 +122,22 @@ public class Sys { return sb.toString(); } + /** + * Quickly finds a char in a string. + * + * @return index if it's there, -1 if not there + */ + public static int searchStringFast(String string, char c) { + int length = string.length(); + for (int i=0;i TERABYTE) { @@ -889,4 +905,7 @@ public class Sys { return null; } + + + }