ColoredString implements EnhancedString { public ColoredString patternToUpper(Pattern p) { char[] modified = plain.clone(); Matcher m = p.matcher(new String(plain)); while (m.find()) { for (int i = m.start(); i < m.end(); i++) { modified[i] = Character.toUpperCase(modified[i]); } } return new ColoredString(modified, codes); } ColoredString(String s); private  ColoredString(char[] plain, String[] codes); int length(); char charAt(int i); CharSequence subSequence(int i, int j); @Override @NotNull String toString(); @Override ColoredString replaceText(Pattern p, String rText); ColoredString patternToLower(Pattern p); ColoredString patternToUpper(Pattern p); @Override boolean equals(Object obj); @Override String getRaw();  }
@Test public void testPatternToUpper(){ assertEquals(new ColoredString("THIS&0 is the string &8to test"), testCs.patternToUpper(Pattern.compile("This"))); }