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


Java StringUtils.strip方法代碼示例

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


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

示例1: getStringPropertyValue

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
@Nullable
private String getStringPropertyValue(String propertyName) {
    JsonStringLiteral stringLiteral = getPropertyValueOfType(propertyName, JsonStringLiteral.class);

    if (stringLiteral != null) {
        return StringUtils.strip(stringLiteral.getText(), "\"");
    }

    return null;
}
 
開發者ID:magento,項目名稱:magento2-phpstorm-plugin,代碼行數:11,代碼來源:ComposerPackageModelImpl.java

示例2: buildMatchPatterns

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
public void buildMatchPatterns() {
  if (StringUtils.isNotEmpty(this.getValue())) {
    patterns.clear();
    String[] expressions = this.getValue().split(",");
    for (String expression : expressions) {
      if (StringUtils.isNotEmpty(expression)) {
        String formalizedPattern = StringUtils.strip(StringUtils.strip(expression, " "), "/");
        patterns.add(Pattern.compile(formalizedPattern));
      }
    }
  }
}
 
開發者ID:pinterest,項目名稱:soundwave,代碼行數:13,代碼來源:EsServiceMapping.java

示例3: copyResourceFolder

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
public static void copyResourceFolder(String resourceFolder, String destDir)
		throws IOException {
	final File jarFile = new File(Util.class.getProtectionDomain()
			.getCodeSource().getLocation().getPath());
	if (jarFile.isFile()) { // Run with JAR file
		resourceFolder = StringUtils.strip(resourceFolder, "/");
		final JarFile jar = new JarFile(jarFile);
		// gives ALL entries in jar
		final Enumeration<JarEntry> entries = jar.entries();
		while (entries.hasMoreElements()) {
			JarEntry element = entries.nextElement();
			final String name = element.getName();
			// filter according to the path
			if (name.startsWith(resourceFolder + "/")) {
				String resDestDir = Util.combineFilePath(destDir,
						name.replaceFirst(resourceFolder + "/", ""));
				if (element.isDirectory()) {
					File newDir = new File(resDestDir);
					if (!newDir.exists()) {
						boolean mkdirRes = newDir.mkdirs();
						if (!mkdirRes) {
							logger.error("Failed to create directory "
									+ resDestDir);
						}
					}
				} else {
					InputStream inputStream = null;
					try {
						inputStream = Util.class.getResourceAsStream("/"
								+ name);
						if (inputStream == null) {
							logger.error("No resource is found:" + name);
						} else {
							Util.outputFile(inputStream, resDestDir);
						}

						/* compress js files */
						inputStream = Util.class.getResourceAsStream("/"
								+ name);
						compressor.compress(inputStream, name, destDir);
					} finally {
						if (inputStream != null) {
							inputStream.close();
						}
					}
				}
			}
		}
		jar.close();
	} else { // Run with IDE
		final URL url = Util.class.getResource(resourceFolder);
		if (url != null) {
			try {
				final File src = new File(url.toURI());
				File dest = new File(destDir);
				FileUtils.copyDirectory(src, dest);
				Util.compressFilesInDir(src, destDir);
			} catch (URISyntaxException ex) {
				logger.error(ex);
			}
		}
	}
}
 
開發者ID:WinRoad-NET,項目名稱:wrdocletbase,代碼行數:64,代碼來源:Util.java

示例4: generateWRAPIFileName

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
protected String generateWRAPIFileName(String container, String url,
		String methodType) {
	return StringUtils.strip(
			(container + '-' + url + (methodType == null ? '-'
					: '-' + methodType + '-')).replace('/', '-')
					.replace('\\', '-').replace(':', '-').replace('*', '-')
					.replace('?', '-').replace('"', '-').replace('<', '-')
					.replace('>', '-').replace('|', '-').replace('{', '-')
					.replace('}', '-'), "-")
			+ ".html";
}
 
開發者ID:WinRoad-NET,項目名稱:htmldoclet4jdk8,代碼行數:12,代碼來源:HtmlDoclet.java

示例5: checkFieldNotEmpty

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
private FormValidation checkFieldNotEmpty(String value, String field) {
    value = StringUtils.strip(value);
    if (value == null || value.equals("")) {
        return FormValidation.error(field + " is required.");
    }
    return FormValidation.ok();
}
 
開發者ID:warriorframework,項目名稱:warrior-jenkins-plugin,代碼行數:8,代碼來源:WarriorPluginBuilder.java

示例6: isSameLicenseType

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
/**
    * Is this license and another license the same license? The licenseID and name fields
    * are checked, with the name fields having any leading or trailing spaces stripped
    * before comparison. If both licenseID fields are null, then they are assumed to be
    * different licenses.
    * 
    * This is to be used when importing designs, to see if licenses match. If the id and
    * name fields match, then the imported design is linked to the license record. If
    * they don't match, the design should be attached to the "Other" license.
    * 
    * The user selects the license based on the name, hence we have chosen to check the name.
    * 
    * @param otherLicense
    * @return true if they are the same type of license
    */
   public boolean isSameLicenseType(License otherLicense) {
if (licenseID != null && licenseID.equals(otherLicense.getLicenseID())) {
    String name1 = (name != null ? StringUtils.strip(name) : "");
    String name2 = (otherLicense.getName() != null ? StringUtils.strip(otherLicense.getName()) : "");
    return name1.equals(name2);
}
return false;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:24,代碼來源:License.java

示例7: strip

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
/**
 * Strips special bracket from the full name.
 *
 * @param fullName full name
 * @return bracket stripped string
 */
private String strip(String fullName) {
    return StringUtils.strip(StringUtils.strip(fullName, BRACKET_START), BRACKET_END);
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:10,代碼來源:DefaultInfluxDbMetricsRetriever.java


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