Java String Quote quote(final CharSequence original)

Here you can find the source of quote(final CharSequence original)

Description

quote

License

Open Source License

Declaration

public static CharSequence quote(final CharSequence original) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {

    public static CharSequence quote(final CharSequence original) {
        final StringBuilder buff = builder().append('"');
        final int len = original.length();
        for (int i = 0; i < len; i++) {
            final char c = original.charAt(i);
            if (c == '"' || c == '#') {
                buff.append('#');
            }/*from   w  ww.  ja  va 2  s . com*/
            buff.append(c);
        }
        buff.append('"');
        buff.trimToSize();
        return buff;
    }

    public static StringBuilder builder() {
        return new StringBuilder();
    }
}

Related

  1. quote(CharSequence cs)
  2. quote(CharSequence str)
  3. quote(CharSequence value)
  4. quote(final CharSequence phrase)
  5. quote(final String s)
  6. quote(final String str)
  7. quote(final String str)