diff options
author | Brian Vosburgh | 2013-08-20 21:29:26 +0000 |
---|---|---|
committer | Brian Vosburgh | 2013-08-26 19:13:45 +0000 |
commit | d43fb229ccda6f6264a01c8f53e17e02080bf1bc (patch) | |
tree | c87b525c47a2c131e98c125eeda4d1a58eb28be1 | |
parent | 9bf4c5933ad1c34ae4df6ed0c0f55bb6275ae180 (diff) | |
download | webtools.dali-d43fb229ccda6f6264a01c8f53e17e02080bf1bc.tar.gz webtools.dali-d43fb229ccda6f6264a01c8f53e17e02080bf1bc.tar.xz webtools.dali-d43fb229ccda6f6264a01c8f53e17e02080bf1bc.zip |
add reverse(...) to StringTools and CharArrayTools
2 files changed, 20 insertions, 0 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CharArrayTools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CharArrayTools.java index 52e946570f..61084ecdad 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CharArrayTools.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CharArrayTools.java @@ -39,6 +39,16 @@ public final class CharArrayTools { public static final char[][] EMPTY_CHAR_ARRAY_ARRAY = new char[0][0]; + // ********** reverse ********** + + /** + * Return a new string with the reverse the characters of the specified string. + */ + public static char[] reverse(char[] string) { + return (string.length == 0) ? string : ArrayTools.reverse(string.clone()); + } + + // ********** last ********** /** diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StringTools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StringTools.java index d83771b07e..acf3d6cd68 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StringTools.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StringTools.java @@ -37,6 +37,16 @@ public final class StringTools { public static final String[] EMPTY_STRING_ARRAY = new String[0]; + // ********** reverse ********** + + /** + * Reverse the characters of the specified string. + */ + public static String reverse(String string) { + return (string.length() == 0) ? string : new String(ArrayTools.reverse(string.toCharArray())); + } + + // ********** last ********** /** |