Here you can find the source of doublequoteEncode(String str)
Parameter | Description |
---|---|
str | the string to encode |
public static String doublequoteEncode(String str)
//package com.java2s; /*************************************** * ViPER * * The Video Processing * * Evaluation Resource * * * * Distributed under the GPL license * * Terms available at gnu.org. * * * * Copyright University of Maryland, * * College Park. * ***************************************/ public class Main { /**// w w w .ja v a2 s. c o m * Doubles every " mark in the string. * @param str the string to encode * @return the string, with each mark doubled */ public static String doublequoteEncode(String str) { StringBuffer buf = new StringBuffer(str.length()); for (int i = 0; i < str.length(); i++) { if (str.charAt(i) == '"') { buf.append("\"\""); } else { buf.append(str.charAt(i)); } } return buf.toString(); } }