當前位置: 首頁>>代碼示例>>Java>>正文


Java StringUtil.capitalize方法代碼示例

本文整理匯總了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);
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:25,代碼來源:EduAdaptiveStepicConnector.java

示例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();
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:16,代碼來源:EduAdaptiveStepicConnector.java


注:本文中的com.intellij.openapi.util.text.StringUtil.capitalize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。