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


Java StringUtil.split方法代碼示例

本文整理匯總了Java中com.intellij.openapi.util.text.StringUtil.split方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtil.split方法的具體用法?Java StringUtil.split怎麽用?Java StringUtil.split使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.util.text.StringUtil的用法示例。


在下文中一共展示了StringUtil.split方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: loadSearchPaths

import com.intellij.openapi.util.text.StringUtil; //導入方法依賴的package包/類
private List<String> loadSearchPaths(@NotNull final Map<String, String> params) {
  String val = params.get(PARAM_SEARCH_PATHS);
  List<String> result;
  if (!StringUtil.isEmptyOrSpaces(val)) {
    result = StringUtil.split(val, ";");
  } else {
    result = Collections.emptyList();
  }
  return result;
}
 
開發者ID:JetBrains,項目名稱:teamcity-powershell,代碼行數:11,代碼來源:DetectionContext.java

示例2: canBeOpened

import com.intellij.openapi.util.text.StringUtil; //導入方法依賴的package包/類
static boolean canBeOpened(RemoteCourse courseInfo) {
  final ArrayList<String> supportedLanguages = new ArrayList<>();
  final LanguageExtensionPoint[] extensions = Extensions.getExtensions(EduPluginConfigurator.EP_NAME, null);
  for (LanguageExtensionPoint extension : extensions) {
    String languageId = extension.getKey();
    supportedLanguages.add(languageId);
  }

  if (courseInfo.isAdaptive()) {
    return supportedLanguages.contains(courseInfo.getLanguageID());
  }

  String courseType = courseInfo.getType();
  final List<String> typeLanguage = StringUtil.split(courseType, " ");
  String prefix = typeLanguage.get(0);
  if (!supportedLanguages.contains(courseInfo.getLanguageID())) return false;
  if (typeLanguage.size() < 2 || !prefix.startsWith(PYCHARM_PREFIX)) {
    return false;
  }
  String versionString = prefix.substring(PYCHARM_PREFIX.length());
  if (versionString.isEmpty()) {
    return true;
  }
  try {
    Integer version = Integer.valueOf(versionString);
    return version <= CURRENT_VERSION;
  }
  catch (NumberFormatException e) {
    LOG.info("Wrong version format", e);
    return false;
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:33,代碼來源:EduStepicConnector.java

示例3: setAuthorsAsString

import com.intellij.openapi.util.text.StringUtil; //導入方法依賴的package包/類
@Transient
public void setAuthorsAsString(String[] authors) {
  this.authors = new ArrayList<>();
  for (String name : authors) {
    final List<String> firstLast = StringUtil.split(name, " ");
    if (!firstLast.isEmpty()) {
      final StepicUser stepicUser = StepicUser.createEmptyUser();
      stepicUser.setFirstName(firstLast.remove(0));
      if (firstLast.size() > 0) {
        stepicUser.setLastName(StringUtil.join(firstLast, " "));
      }
      this.authors.add(stepicUser);
    }
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:16,代碼來源:Course.java

示例4: isValidFilePath

import com.intellij.openapi.util.text.StringUtil; //導入方法依賴的package包/類
protected String isValidFilePath(@NotNull String fullFilePath, @NotNull PsiDirectory baseDirectory) {
    String filePath = StringUtil.replace(
            fullFilePath,
            File.separator,
            "/"
    );

    if(filePath.length() == 0) {
        return PhpBundle.message(
            "validation.file.not.valid.name",
                fullFilePath);
    } else {
        List<String> split = StringUtil.split(filePath, "/");
        if(split.size() == 0) {
            return PhpBundle.message(
                "validation.file.not.valid.name",
                    fullFilePath);
        } else {
            for (String aSplit : split) {
                if (!PhpNameUtil.isValidFileName(aSplit)) {
                    return PhpBundle.message(
                        "validation.file.not.valid.name",
                            fullFilePath);
                }
            }

            VirtualFile baseDirectoryFile = baseDirectory.getVirtualFile();
            VirtualFile fileByRelativePath = baseDirectoryFile.findFileByRelativePath(
                    PhpNameUtil.trimStart(
                            filePath,
                            '/')
            );

            if (fileByRelativePath != null) {
                return PhpBundle.message(
                    "validation.file.already.exists",
                        fullFilePath);
            } else {
                return null;
            }
        }
    }
}
 
開發者ID:aurimasniekis,項目名稱:idea-php-class-templates,代碼行數:44,代碼來源:PhpNewClassDialog.java


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