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