本文整理汇总了Java中com.intellij.openapi.util.text.StringUtil.capitalize方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtil.capitalize方法的具体用法?Java StringUtil.capitalize怎么用?Java StringUtil.capitalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.text.StringUtil
的用法示例。
在下文中一共展示了StringUtil.capitalize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doAdaptiveCheck
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
private static StudyCheckResult doAdaptiveCheck(@NotNull StepicWrappers.SubmissionToPostWrapper submission,
int attemptId, int userId) {
final CloseableHttpClient client = EduStepicAuthorizedClient.getHttpClient();
if (client != null) {
StepicWrappers.ResultSubmissionWrapper wrapper = postResultsForCheck(client, submission);
if (wrapper != null) {
wrapper = getCheckResults(client, wrapper, attemptId, userId);
if (wrapper.submissions.length > 0) {
final String status = wrapper.submissions[0].status;
final String hint = wrapper.submissions[0].hint;
final boolean isSolved = !status.equals("wrong");
return new StudyCheckResult(isSolved ? StudyStatus.Solved : StudyStatus.Failed, hint.isEmpty() ? StringUtil.capitalize(status) + " solution" : hint);
}
else {
LOG.warn("Got a submission wrapper with incorrect submissions number: " + wrapper.submissions.length);
}
}
else {
LOG.warn("Can't do adaptive check: " + "wrapper is null");
return new StudyCheckResult(StudyStatus.Unchecked, "Can't get check results for Stepik");
}
}
return new StudyCheckResult(StudyStatus.Unchecked, StudyCheckAction.FAILED_CHECK_LAUNCH);
}
示例2: getTaskFileName
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
@Nullable
private static String getTaskFileName(@NotNull Language language) {
// This is a hacky way to how we should name task file.
// It's assumed that if test's name is capitalized we need to capitalize task file name too.
String testFileName = EduPluginConfigurator.INSTANCE.forLanguage(language).getTestFileName();
boolean capitalize = !testFileName.isEmpty() && Character.isUpperCase(testFileName.charAt(0));
LanguageFileType type = language.getAssociatedFileType();
if (type == null) {
LOG.warn("Failed to create task file name: associated file type for " + language + " is null");
return null;
}
return (capitalize ? StringUtil.capitalize(TASK_NAME) : TASK_NAME) + "." + type.getDefaultExtension();
}