当前位置: 首页>>代码示例>>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;未经允许,请勿转载。