mirror of
https://github.com/shekhargulati/strman-java.git
synced 2026-10-06 03:23:55 +00:00
Fixed #6. Added support for inequal function
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
package strman;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Base64;
|
||||
import java.util.Optional;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -468,6 +465,16 @@ public abstract class Strman {
|
||||
return value.toLowerCase().indexOf(needle.toLowerCase(), offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if two Strings are inequal
|
||||
* @param first The first String
|
||||
* @param second The second String
|
||||
* @return true if first and second are not equal false otherwise
|
||||
*/
|
||||
public static boolean inequal(final String first, final String second) {
|
||||
return !Objects.equals(first, second);
|
||||
}
|
||||
|
||||
|
||||
public static String leftPad(final String value, final String pad, final int length) {
|
||||
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
|
||||
|
||||
@@ -379,6 +379,12 @@ public class StrmanTest {
|
||||
assertThat(indexOf(value, "A", 0, false), equalTo(4));
|
||||
assertThat(indexOf(value, "R", 0, false), equalTo(5));
|
||||
assertThat(indexOf(value, "T", 0, false), equalTo(-1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void inequal_shouldTestInequalityOfStrings() throws Exception {
|
||||
assertThat(inequal("a", "b"), equalTo(true));
|
||||
assertThat(inequal("a", "a"), equalTo(false));
|
||||
assertThat(inequal("0", "1"), equalTo(true));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user