mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
Don't warn that "iOS" is not capitalized: it shouldn't: IDEA-226591
GitOrigin-RevId: 6bae9cc8e16d9038cae815f9ad3231ac4bfb1ee5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bcb954642f
commit
4c71808b61
@@ -59,6 +59,11 @@ public class NlsCapitalizationUtilTest extends TestCase {
|
||||
public void testSentenceTooManyUppercaseWords() {
|
||||
assertNotCapitalization("Four Upper Case Words two lowercase", Nls.Capitalization.Sentence);
|
||||
}
|
||||
|
||||
public void testiOSDoesntNeedCapitalization() {
|
||||
assertTitle("iOS");
|
||||
}
|
||||
|
||||
public void testTitle() {
|
||||
assertTitle("Word");
|
||||
assertTitle("Word Two");
|
||||
|
||||
@@ -469,7 +469,7 @@ public class StringUtil extends StringUtilRt {
|
||||
@NotNull
|
||||
@Contract(pure = true)
|
||||
public static String wordsToBeginFromUpperCase(@NotNull String s) {
|
||||
return fixCapitalization(s, ourPrepositions, true);
|
||||
return fixCapitalization(s, ArrayUtil.mergeArrays(ourPrepositions, ourOtherNonCapitalizableWords), true);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -521,6 +521,10 @@ public class StringUtil extends StringUtilRt {
|
||||
"per", "nor", "the", "to", "up", "upon", "via", "with"
|
||||
};
|
||||
|
||||
private static final String[] ourOtherNonCapitalizableWords = {
|
||||
"iOS", "iPhone", "iPad", "iMac"
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #isPreposition(String, int, int, String[])}.
|
||||
*/
|
||||
@@ -538,7 +542,7 @@ public class StringUtil extends StringUtilRt {
|
||||
if (lastChar - firstChar + 1 == preposition.length()) {
|
||||
found = true;
|
||||
for (int j = 0; j < preposition.length(); j++) {
|
||||
if (toLowerCase(s.charAt(firstChar + j)) != preposition.charAt(j)) {
|
||||
if (toLowerCase(s.charAt(firstChar + j)) != toLowerCase(preposition.charAt(j))) {
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user