Klasse StringOperation
-
Konstruktorübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic final int[]
getCamelCaseMatchingRegions
(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd, boolean samePartCount) Answers all the regions in a given name matching a given camel case pattern.static final int[]
getPatternMatchingRegions
(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd, boolean isCaseSensitive) Answers all the regions in a given name matching a given pattern pattern (e.g.
-
Konstruktordetails
-
StringOperation
public StringOperation()
-
-
Methodendetails
-
getCamelCaseMatchingRegions
public static final int[] getCamelCaseMatchingRegions(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd, boolean samePartCount) Answers all the regions in a given name matching a given camel case pattern.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 }
, thenstart1+length1
will always be smaller thanstart2
.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 }
- Parameter:
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.
For example:- 'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types, but not 'HashMapEntry'
- 'HMap' type string pattern will still match previous 'HashMap' and 'HtmlMapper' types, but not 'HighMagnitude'
- Gibt zurück:
- an array of
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).
Note that it may benull
if the given name does not match the pattern - Seit:
- 3.5
- Siehe auch:
-
getPatternMatchingRegions
public static final int[] getPatternMatchingRegions(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd, boolean isCaseSensitive) Answers all the regions in a given name matching a given pattern pattern (e.g. "H*M??").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 }
, thenstart1+length1
will always be smaller thanstart2
.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 }
- Parameter:
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 sensitive- Gibt zurück:
- an array of
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).
Note that it may benull
if the given name does not match the pattern - Seit:
- 3.5
- Siehe auch:
-