X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FStringUtils.java;h=273f6ec8e9529e071de437aaabe7c5f75aea8b18;hb=4d71acba1cc4999e8e4061ec3e9ae55e1b37084e;hp=bf5b87a4f873a2ba9185109467cb4c5ef634fc9d;hpb=9d2408483e451285fd555c3cd6e0273977acbaa7;p=jalview.git diff --git a/src/jalview/util/StringUtils.java b/src/jalview/util/StringUtils.java index bf5b87a..273f6ec 100644 --- a/src/jalview/util/StringUtils.java +++ b/src/jalview/util/StringUtils.java @@ -448,7 +448,7 @@ public class StringUtils { text = text.substring(0, endTag); } - + if (startTag == -1 && (text.contains("<") || text.contains(">"))) { text = text.replaceAll("<", "<"); @@ -458,8 +458,8 @@ public class StringUtils } /** - * Answers the input string with any occurrences of the 'encodeable' characters - * replaced by their URL encoding + * Answers the input string with any occurrences of the 'encodeable' + * characters replaced by their URL encoding * * @param s * @param encodable @@ -570,4 +570,18 @@ public class StringUtils } return enc; } + + public static int firstCharPosIgnoreCase(String text, String chars) + { + int min = text.length() + 1; + for (char c : chars.toLowerCase().toCharArray()) + { + int i = text.toLowerCase().indexOf(c); + if (0 <= i && i < min) + { + min = i; + } + } + return min < text.length() + 1 ? min : -1; + } }