當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。