improve title capitalization utility method (IDEA-296630)

for the "Incorrect string capitalization" inspection

GitOrigin-RevId: 26358913496d218e21a071c3f0b1058ea3f45ca2
This commit is contained in:
Bas Leijdekkers
2022-06-24 17:30:47 +02:00
committed by intellij-monorepo-bot
parent 539cd38b54
commit 9c47f6dd89
7 changed files with 72 additions and 45 deletions

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInspection;
import com.intellij.openapi.util.text.StringUtil;
@@ -13,7 +13,6 @@ public class NlsCapitalizationUtil {
if (StringUtil.isEmpty(value) || capitalization == Nls.Capitalization.NotSpecified) {
return true;
}
value = value.replace("&", "");
return capitalization == Nls.Capitalization.Title
? StringUtil.wordsToBeginFromUpperCase(value).equals(value)
: checkSentenceCapitalization(value);