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


Java StringEscapeUtils.escapeJava方法代码示例

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


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

示例1: json

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
private static String json(Type<?> p) {
    if (p == null) return "null";
    if (p instanceof NumericType || p instanceof Bool) {
        return p.getValue().toString();
    } 
    if (p instanceof Array) {
        return "[" + json(((Array<?>) p).getValue()) + "]";
    }
    Object value = p.getValue();
    String str;
    if (value instanceof byte[]) {
        str = Numeric.toHexStringNoPrefix((byte[]) value);
    } else {
        str = value.toString();
    }
    return "\"" + StringEscapeUtils.escapeJava(str) + "\"";
}
 
开发者ID:papyrusglobal,项目名称:state-channels,代码行数:18,代码来源:CallUtil.java

示例2: setText

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
public void setText(String text)
{
	// TODO: update StringEscapeUtils and use escapeJavaScript() instead
	text = StringEscapeUtils.escapeJava(text);
	codeBodyProperty.set(text);
	System.out.println("Setting value");
	webView.getEngine().executeScript(
			"window.onload = function() {"
			+ "editor.on(\"change\", function(){});"
			+ "editor.setValue(\"" + text + "\","
					+ text.length() + ");"
			+ "editor.on(\"change\", function() {"
			+ "javaContentModel.updateTextFromJavascript(editor.getValue());"
			+ "});"
			+ "javaContentModel.println(\"Value Set\");"
			+ "};"
			);
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:19,代码来源:CodeEditor.java

示例3: buildActionStep

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
private String buildActionStep(TestStepDTO testStepDTO) {
	String actionString = "";
	actionString = "\t\tseleniumKeywords."
			+ ActionsMapping.getAction(testStepDTO.getAction().toLowerCase());
	actionString += "(\"" + testStepDTO.getLocateElement().getBy() + "\"";
	String locatorValue = testStepDTO.getLocateElement().getValue();
	actionString += ", \"" + StringEscapeUtils.escapeJava(locatorValue) + "\"";

	if (testStepDTO.getThirdPara() != null) {
		actionString += ", \"" + testStepDTO.getThirdPara() + "\");";
	} else {
		actionString += ");";
	}
	return actionString;
}
 
开发者ID:sergueik,项目名称:SWET,代码行数:16,代码来源:WriteScriptFile.java

示例4: onRowAdded

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
protected void onRowAdded(List<? extends SpecificationRow<C>> added) {
  for (SpecificationRow<C> addedRow : added) {
    // Check correctness of added row
    if (addedRow.getCells().size() != columnHeaders.size()) {
      throw new IllegalArgumentException(
          "Illegal width for row " + StringEscapeUtils.escapeJava(addedRow.toString())
              + ", expected width: " + columnHeaders.size());
    }
    if (!addedRow.getCells().keySet().stream()
        .allMatch(columnId -> getOptionalColumnHeaderByName(columnId).isPresent())) {
      throw new IllegalArgumentException("Added row contains unknown IoVariable: "
          + StringEscapeUtils.escapeJava(addedRow.toString()));
    }
  }
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:16,代码来源:SpecificationTable.java

示例5: tryToGetValidName

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
private static String tryToGetValidName(FreeVariable freeVariable)
        throws InvalidFreeVariableProblem {
    String varName = freeVariable.getName();
    if (VariableExpr.IDENTIFIER_PATTERN.matcher(varName).matches()) {
        return varName;
    }
    else {
        throw new InvalidFreeVariableProblem(
                "Variable has illegal characters in name: "
                        + StringEscapeUtils.escapeJava(varName));
    }
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:13,代码来源:InvalidFreeVariableProblem.java

示例6: tryToGetValidType

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
private static Type tryToGetValidType(FreeVariable freeVariable,
        Map<String, Type> typesByName) throws InvalidFreeVariableProblem {
    Type foundType = typesByName.get(freeVariable.getType());
    if (foundType == null) {
        throw new InvalidFreeVariableProblem(
                "Variable has unknown type: " + StringEscapeUtils
                        .escapeJava(freeVariable.getType()));
    }
    return foundType;
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:11,代码来源:InvalidFreeVariableProblem.java

示例7: getEscapedSearchString

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * Gets the text of the search query.
 * @return String containing the query target.
 */
public String getEscapedSearchString() {
    return StringEscapeUtils.escapeJava(searchString);
}
 
开发者ID:RBMHTechnology,项目名称:vind,代码行数:8,代码来源:FulltextSearch.java

示例8: escapeJava

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * Escapes the characters in a {@code String} using Java String rules.
 *
 * Deals correctly with quotes and control-chars (tab, backslash, cr, ff, etc.)
 *
 * So a tab becomes the characters {@code '\\'} and
 * {@code 't'}.
 *
 * Example:
 * <pre>
 * input string: He didn't say, "Stop!"
 * output string: He didn't say, \"Stop!\"
 * </pre>
 *
 * @param input  String to escape values in, may be null
 * @return String with escaped values, {@code null} if null string input
 */
public static final String escapeJava(String input) {
  return StringEscapeUtils.escapeJava(input);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:21,代码来源:DrillStringUtils.java

示例9: escapeJava

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * Escapes the characters in a {@code String} according to Java string literal
 * rules.
 *
 * Deals correctly with quotes and control-chars (tab, backslash, cr, ff,
 * etc.) so, for example, a tab becomes the characters {@code '\\'} and
 * {@code 't'}.
 *
 * Example:
 * <pre>
 * input string: He didn't say, "Stop!"
 * output string: He didn't say, \"Stop!\"
 * </pre>
 *
 * @param input  String to escape values in, may be null
 * @return String with escaped values, {@code null} if null string input
 */
public static final String escapeJava(String input) {
  return StringEscapeUtils.escapeJava(input);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:21,代码来源:DremioStringUtils.java

示例10: debuggingString

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * <p>
 * Prints a minimal string including the string representation and optionally adds the comment, if
 * not null.
 * </p>
 *
 * <p>
 * (should only used for debugging purposes, i.e. in toString methods)
 * </p>
 *
 * @return a minimal string
 */
default String debuggingString() {
  return getAsString() + (getComment() == null ? ""
      : " (comment: \"" + StringEscapeUtils.escapeJava(getComment()) + "\")");
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:17,代码来源:CellOperationProvider.java

示例11: DuplicateFreeVariableProblem

import org.apache.commons.lang3.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * Private constructor: DuplicateFreeVariableProblems can only be created from the static
 * method {@link DuplicateFreeVariableProblem#checkForDuplicates}.
 * @param freeVariableName the name of the duplicate variable
 */
private DuplicateFreeVariableProblem(String freeVariableName) {
  super(
      "More than one free variable with name " + StringEscapeUtils.escapeJava(freeVariableName));
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:10,代码来源:DuplicateFreeVariableProblem.java


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