git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9c7541f
)
JAL-2292 Wrote utility method for comparing two char either case sensitively or insen...
author
tcofoegbu
<tcnofoegbu@dundee.ac.uk>
Fri, 4 Nov 2016 15:26:44 +0000
(15:26 +0000)
committer
tcofoegbu
<tcnofoegbu@dundee.ac.uk>
Fri, 4 Nov 2016 15:26:44 +0000
(15:26 +0000)
src/jalview/util/Comparison.java
patch
|
blob
|
history
diff --git
a/src/jalview/util/Comparison.java
b/src/jalview/util/Comparison.java
index
0beb45b
..
a8ad086
100644
(file)
--- a/
src/jalview/util/Comparison.java
+++ b/
src/jalview/util/Comparison.java
@@
-415,4
+415,23
@@
public class Comparison
.size()]);
return isNucleotide(oneDArray);
}
+
+ public static boolean compareChars(char c1, char c2, boolean caseSensitive)
+ {
+ boolean sameCase = (Character.isUpperCase(c1) && Character
+ .isUpperCase(c2))
+ || (Character.isLowerCase(c1) && Character.isLowerCase(c2));
+ if (sameCase)
+ {
+ return c1 == c2;
+ }
+ else if (caseSensitive)
+ {
+ return false;
+ }
+ else
+ {
+ return Character.toUpperCase(c1) == Character.toUpperCase(c2);
+ }
+ }
}