当前位置: 首页>>代码示例>>Java>>正文


Java StringEscapeUtils.unescapeJava方法代码示例

本文整理汇总了Java中org.apache.commons.lang3.StringEscapeUtils.unescapeJava方法的典型用法代码示例。如果您正苦于以下问题:Java StringEscapeUtils.unescapeJava方法的具体用法?Java StringEscapeUtils.unescapeJava怎么用?Java StringEscapeUtils.unescapeJava使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang3.StringEscapeUtils的用法示例。


在下文中一共展示了StringEscapeUtils.unescapeJava方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: encodeURIinUTF8

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
public static String encodeURIinUTF8(String uri) {
    if (uri.startsWith("<http://dbpedia.org/resource/")) {            
        int splitPoint = uri.lastIndexOf("/")+1;
        String infix = uri.substring(splitPoint, uri.length()-1);
        if (infix.contains("%")) {
            return uri;
        }
        try {
            infix = infix.replace("\\\\", "\\");
            infix = StringEscapeUtils.unescapeJava(infix);
            infix = URLEncoder.encode(infix, "UTF-8");            
        } catch (UnsupportedEncodingException ex) {
            System.err.println("Encoding exception: "+ex);
        }
        uri = uri.substring(0, splitPoint) + infix + ">";            
    }
    return uri;
}
 
开发者ID:vefthym,项目名称:MinoanER,代码行数:19,代码来源:Utils.java

示例2: findCrumb

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
public String findCrumb(List<String> lines) {
    String crumb = "";
    String rtn = "";
    for (String l : lines) {
        if (l.indexOf("CrumbStore") > -1) {
            rtn = l;
            break;
        }
    }
    // ,"CrumbStore":{"crumb":"OKSUqghoLs8"        
    if (rtn != null && !rtn.isEmpty()) {
        String[] vals = rtn.split(":");                 // get third item
        crumb = vals[2].replace("\"", "");              // strip quotes
        crumb = StringEscapeUtils.unescapeJava(crumb);  // unescape escaped values (particularly, \u002f
        }
    return crumb;
}
 
开发者ID:bradlucas,项目名称:get-yahoo-quotes-java,代码行数:18,代码来源:GetYahooQuotes.java

示例3: getLastPatchFile

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
protected File getLastPatchFile(String baseApkVersion,
                                String productName,
                                File outPatchDir) throws IOException {
    try {
        String httpUrl = ((TpatchInput)input).LAST_PATCH_URL +
                "baseVersion=" +
                baseApkVersion +
                "&productIdentifier=" +
                productName;
        String response = HttpClientUtils.getUrl(httpUrl);
        if (StringUtils.isBlank(response) ||
                response.equals("\"\"")) {
            return null;
        }
        File downLoadFolder = new File(outPatchDir, "LastPatch");
        downLoadFolder.mkdirs();
        File downLoadFile = new File(downLoadFolder, "lastpatch.tpatch");
        String downLoadUrl = StringEscapeUtils.unescapeJava(response);
        downloadTPath(downLoadUrl.substring(1, downLoadUrl.length() - 1), downLoadFile);

        return downLoadFile;
    } catch (Exception e) {
        return null;
    }
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:26,代码来源:TPatchTool.java

示例4: convertMessage

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
private String convertMessage(String message, Map<String, String> headers) {
    String newMessage = message;
    JsonElement msgRootElement = parser.parse(message);
    if (msgRootElement instanceof JsonObject) {
        JsonObject msgRoot = (JsonObject)msgRootElement;

        JsonElement element = msgRoot.get(PAYLOAD_ELEMENT_KEY);
        if (element != null) {
            if (!element.isJsonObject()) {
                //convert payLoad to a json object if it is not already
                msgRoot.remove(PAYLOAD_ELEMENT_KEY);
                String realPayload = element.getAsString();
                String escapedPayload = StringEscapeUtils.unescapeJava(realPayload);
                msgRoot.add(PAYLOAD_ELEMENT_KEY, parser.parse(escapedPayload));
            }
        }
        JsonElement hdrElement = GSON.toJsonTree(headers);
        msgRoot.add("msgHeaders", hdrElement);
        newMessage = GSON.toJson(msgRoot);
        if (logger.isDebugEnabled()) {
            logger.debug("message to be indexed " + newMessage);
        }
    }
    return newMessage;
}
 
开发者ID:oneops,项目名称:oneops,代码行数:26,代码来源:DLQMessageProcessor.java

示例5: convertToJavaEnumName

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * Converteer een naam naar een java enumeratie naam.
 * @param javaNameBase naam
 * @return enumeratie naam
 */
public static String convertToJavaEnumName(final String javaNameBase) {
    if (javaNameBase.startsWith(LITERAL)) {
        return StringEscapeUtils.unescapeJava(javaNameBase.replaceAll(String.format("^%s", LITERAL), ""));
    } else {
        String result = javaNameBase;

        // Unaccent
        result = Normalizer.normalize(result, Normalizer.Form.NFD);
        // Replace whitespace with underscore
        result = result.replaceAll("(\\s|-)", "_");
        // Uppercase
        result = result.toUpperCase();
        // Remove unsupported characters
        result = result.replaceAll("[^A-Z0-9_]", "");
        // Remove duplicate seperators
        result = result.replaceAll("_{2,}", "_");

        return result;
    }
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:26,代码来源:Utils.java

示例6: getClassInitBodyUnescaped

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
public String getClassInitBodyUnescaped(){
	if(classInitBody==null)
		return null;
	
	Pattern pattern = Pattern.compile("\\t+");
    Matcher matcher = pattern.matcher(StringEscapeUtils.unescapeJava(this.classInitBody));
    StringBuilder sb=new StringBuilder(StringEscapeUtils.unescapeJava(this.classInitBody));
    
    while(matcher.find()){
    	sb.insert(matcher.start(), CodeStringBuilder.getTabString());
    }
    
    String tempString=sb.toString();
    
    pattern=Pattern.compile("\\n+");
    matcher=pattern.matcher(tempString);
    
    while(matcher.find()){
    	sb.insert(matcher.end(), CodeStringBuilder.getTabString());
    }
	return sb.toString();
}
 
开发者ID:shoaib-a-khan,项目名称:iConA,代码行数:23,代码来源:ClassDAO.java

示例7: NbtTagValue

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
public NbtTagValue(String p_i61_1_, String p_i61_2_)
{
    String[] astring = Config.tokenize(p_i61_1_, ".");
    this.parents = (String[])Arrays.copyOfRange(astring, 0, astring.length - 1);
    this.name = astring[astring.length - 1];

    if (p_i61_2_.startsWith("pattern:"))
    {
        this.type = 1;
        p_i61_2_ = p_i61_2_.substring("pattern:".length());
    }
    else if (p_i61_2_.startsWith("ipattern:"))
    {
        this.type = 2;
        p_i61_2_ = p_i61_2_.substring("ipattern:".length()).toLowerCase();
    }
    else if (p_i61_2_.startsWith("regex:"))
    {
        this.type = 3;
        p_i61_2_ = p_i61_2_.substring("regex:".length());
    }
    else if (p_i61_2_.startsWith("iregex:"))
    {
        this.type = 4;
        p_i61_2_ = p_i61_2_.substring("iregex:".length()).toLowerCase();
    }
    else
    {
        this.type = 0;
    }

    p_i61_2_ = StringEscapeUtils.unescapeJava(p_i61_2_);
    this.value = p_i61_2_;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:35,代码来源:NbtTagValue.java

示例8: normaliseHeader

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
/**
 *
 * @param columnName
 * @return the normalised string
 */
public static String normaliseHeader(String columnName) {
	columnName = StringEscapeUtils.unescapeJava(columnName);
	columnName = columnName.replace("\"", "");
	columnName = columnName.replace("|", " ");
	columnName = columnName.replace(",", "");
	columnName = columnName.replace("{", "");
	columnName = columnName.replace("}", "");
	columnName = columnName.replaceAll("\n", "");

	columnName = columnName.replace("&nbsp;", " ");
	columnName = columnName.replace("&nbsp", " ");
	columnName = columnName.replace("nbsp", " ");
	columnName = columnName.replaceAll("<.*>", "");

	columnName = columnName.toLowerCase();
	columnName = columnName.trim();

	columnName = columnName.replaceAll("\\.", "");
	columnName = columnName.replaceAll("\\$", "");
	// clean the values from additional strings
	if (columnName.contains("/")) {
		columnName = columnName.substring(0, columnName.indexOf("/"));
	}

	if (columnName.contains("\\")) {
		columnName = columnName.substring(0, columnName.indexOf("\\"));
	}
	if (possibleNullValues.contains(columnName)) {
		columnName = nullValue;
	}
	
	return columnName;
}
 
开发者ID:olehmberg,项目名称:winter,代码行数:39,代码来源:WebTablesStringNormalizer.java

示例9: getClassEndBodyUnescaped

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
public String getClassEndBodyUnescaped(){
	if(classEndBody==null)
		return null;
	
	Pattern pattern = Pattern.compile("\\t+");
    Matcher matcher = pattern.matcher(StringEscapeUtils.unescapeJava(this.classEndBody));
    StringBuilder sb=new StringBuilder(StringEscapeUtils.unescapeJava(this.classEndBody));
    
    while(matcher.find()){
    	sb.insert(matcher.start(), CodeStringBuilder.getTabString());
    }
	return sb.toString();
}
 
开发者ID:shoaib-a-khan,项目名称:iConA,代码行数:14,代码来源:ClassDAO.java

示例10: getFunctionInitBodyUnescaped

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * Pretifies the function initialization body of the function, by adding appropriate number of tabs
 * @return Pretified code
 */
public String getFunctionInitBodyUnescaped(){
	if(functionInitBody==null)
		return null;
	
	Pattern pattern = Pattern.compile("\\t+");
    Matcher matcher = pattern.matcher(StringEscapeUtils.unescapeJava(this.functionInitBody));
    StringBuilder sb=new StringBuilder(StringEscapeUtils.unescapeJava(this.functionInitBody));
    
    while(matcher.find()){
    	sb.insert(matcher.start(), CodeStringBuilder.getTabString());
    }
	return StringEscapeUtils.unescapeJava(sb.toString());
}
 
开发者ID:shoaib-a-khan,项目名称:iConA,代码行数:18,代码来源:FunctionDAO.java

示例11: NbtTagValue

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
public NbtTagValue(String p_i66_1_, String p_i66_2_)
{
    String[] astring = Config.tokenize(p_i66_1_, ".");
    this.parents = (String[])Arrays.copyOfRange(astring, 0, astring.length - 1);
    this.name = astring[astring.length - 1];

    if (p_i66_2_.startsWith("pattern:"))
    {
        this.type = 1;
        p_i66_2_ = p_i66_2_.substring("pattern:".length());
    }
    else if (p_i66_2_.startsWith("ipattern:"))
    {
        this.type = 2;
        p_i66_2_ = p_i66_2_.substring("ipattern:".length()).toLowerCase();
    }
    else if (p_i66_2_.startsWith("regex:"))
    {
        this.type = 3;
        p_i66_2_ = p_i66_2_.substring("regex:".length());
    }
    else if (p_i66_2_.startsWith("iregex:"))
    {
        this.type = 4;
        p_i66_2_ = p_i66_2_.substring("iregex:".length()).toLowerCase();
    }
    else
    {
        this.type = 0;
    }

    p_i66_2_ = StringEscapeUtils.unescapeJava(p_i66_2_);

    if (this.type == 0 && PATTERN_HEX_COLOR.matcher(p_i66_2_).matches())
    {
        this.valueFormat = 1;
    }

    this.value = p_i66_2_;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:41,代码来源:NbtTagValue.java

示例12: unescapeString

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * <p>Unescapes any Java literals found in the <code>String</code>.
 * For example, it will turn a sequence of <code>'\'</code> and
 * <code>'n'</code> into a newline character, unless the <code>'\'</code>
 * is preceded by another <code>'\'</code>.</p>
 *
 * @param str  the <code>String</code> to unescape, may be null
 * @return a new unescaped <code>String</code>, <code>null</code> if null string input
 */
public static String unescapeString(String str) {
    return StringEscapeUtils.unescapeJava(str);
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:13,代码来源:YamlStringEscapeUtils.java

示例13: unescapeJava

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * Unescapes any Java literals found in the {@code String}.
 * For example, it will turn a sequence of {@code '\'} and
 * {@code 'n'} into a newline character, unless the {@code '\'}
 * is preceded by another {@code '\'}.
 *
 * @param input  the {@code String} to unescape, may be null
 * @return a new unescaped {@code String}, {@code null} if null string input
 */
public static final String unescapeJava(String input) {
  return StringEscapeUtils.unescapeJava(input);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:13,代码来源:DrillStringUtils.java


注:本文中的org.apache.commons.lang3.StringEscapeUtils.unescapeJava方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。