public final class StringOperation
extends java.lang.Object
| Constructor and Description |
|---|
StringOperation() |
| Modifier and Type | Method and Description |
|---|---|
static int[] |
getCamelCaseMatchingRegions(java.lang.String pattern,
int patternStart,
int patternEnd,
java.lang.String name,
int nameStart,
int nameEnd,
boolean samePartCount)
Answers all the regions in a given name matching a given camel case pattern.
|
static int[] |
getPatternMatchingRegions(java.lang.String pattern,
int patternStart,
int patternEnd,
java.lang.String name,
int nameStart,
int nameEnd,
boolean isCaseSensitive)
Answers all the regions in a given name matching a given pattern
pattern (e.g.
|
public static final int[] getCamelCaseMatchingRegions(java.lang.String pattern,
int patternStart,
int patternEnd,
java.lang.String name,
int nameStart,
int nameEnd,
boolean samePartCount)
Each of these regions is made of its starting index and its length in the given
name. They are all concatenated in a single array of int
which therefore always has an even length.
Note that each region is disjointed from the following one.
E.g. if the regions are { start1, length1, start2, length2 },
then start1+length1 will always be smaller than
start2.
Examples:
- pattern = "NPE" name = NullPointerException / NoPermissionException result: { 0, 1, 4, 1, 11, 1 } / { 0, 1, 2, 1, 12, 1 }
- pattern = "NuPoEx" name = NullPointerException result: { 0, 2, 4, 2, 11, 2 }
- pattern = "IPL3" name = "IPerspectiveListener3" result: { 0, 2, 12, 1, 20, 1 }
- pattern = "HashME" name = "HashMapEntry" result: { 0, 5, 7, 1 }
pattern - the given patternpatternStart - the start index of the pattern, inclusivepatternEnd - the end index of the pattern, exclusivename - the given namenameStart - the start index of the name, inclusivenameEnd - the end index of the name, exclusivesamePartCount - flag telling whether the pattern and the name should
have the same count of parts or not.int having two slots per returned
regions (first one is the starting index of the region and the second
one the length of the region).null if the given name does not match
the patternfor more details on the camel case behavior,
for more details on the
pattern match behaviorpublic static final int[] getPatternMatchingRegions(java.lang.String pattern,
int patternStart,
int patternEnd,
java.lang.String name,
int nameStart,
int nameEnd,
boolean isCaseSensitive)
Each of these regions is made of its starting index and its length in the given
name. They are all concatenated in a single array of int
which therefore always has an even length.
Note that each region is disjointed from the following one.
E.g. if the regions are { start1, length1, start2, length2 },
then start1+length1 will always be smaller than
start2.
Examples:
- pattern = "N???Po*Ex?eption" name = NullPointerException result: { 0, 1, 4, 2, 11, 2, 14, 6 }
- pattern = "Ha*M*ent*" name = "HashMapEntry" result: { 0, 2, 4, 1, 7, 3 }
pattern - the given patternpatternStart - the given pattern startpatternEnd - the given pattern endname - the given namenameStart - the given name startnameEnd - the given name endisCaseSensitive - flag to know if the matching should be case sensitiveint having two slots per returned
regions (first one is the starting index of the region and the second
one the length of the region).null if the given name does not match
the patternfor more details on the
pattern match behavior