Remove any leading and trailing single-quotes or double-quotes from the supplied text.

@param text the input text; may not be null
@return the text without leading and trailing quotes, or <code>text</code> if there were no square brackets or quotes
14333
protected String removeQuotes( String text ) {
        assert text != null;
        if (text.length() > 2) {
            char first = text.charAt(0);
            // Need to remove these only if they are paired ...
            if (first == '"' || first == '\'') {
                int indexOfLast = text.length() - 1;
                char last = text.charAt(indexOfLast);
                if (last == first) {
                    text = text.substring(1, indexOfLast);
                }
            }
        }
        return text;
    }
1221172
public List<String> tokenize(String text) {
		List<String> tokens = new ArrayList<String>();
		text = text.toLowerCase();
		char[] array = text.toCharArray();
		
		//convert all apostrophes to 0x27
		for(int i = 0; i < array.length; i++) {
			if(isApostrofe(array[i])) array[i] = 0x27;
		}
		
		int pos = 0;
		
		//term cycle
		while(pos < array.length) {
			//scan to the start of the term
			while(pos < array.length  && !Character.isLetterOrDigit(array[pos])) pos++;
			int start = pos;
			if(start == array.length) break;
			//scan to the end of the term
			while(pos < array.length  && isLetterOrDigitOrApostrofe(array[pos])) pos++;
			int newpos = pos;
			while(newpos > start && isApostrofe(array[newpos - 1])) newpos--;
			if(newpos > start) tokens.add(new String(array, start, newpos - start));
		}
		return tokens;
	}
1133188
public static String urlquote(String text) {
        try {
            return URLEncoder.encode(text, "UTF-8").replace("+", "%20");
        } catch (UnsupportedEncodingException ex) {
            throw new RuntimeException(ex);
        }
    }
1243420
public static String escape(String text) {
        boolean hasQuote = text.indexOf(QUOTE) >= 0;
        boolean hasComma = text.indexOf(COMMA) >= 0;

        if (!(hasQuote || hasComma)) {
            return text;
        }

        StringBuilder builder = new StringBuilder();

        if (hasQuote) {
            for (int i = 0; i < text.length(); i++) {
                char c = text.charAt(i);

                if (c == QUOTE) {
                    builder.append(QUOTE_ESCAPED);
                } else {
                    builder.append(c);
                }
            }
        } else {
            builder.append(text);
        }

        if (hasComma) {
            builder.insert(0, QUOTE);
            builder.append(QUOTE);
        }
        return builder.toString();
    }
763331
public static String clean(String text) {
        if (text == null)
            return "";

        text = text.trim();
        text = text.replace("\"", "\\\"");
        text = text.replace("\'", "\\\'");
        text = text.replace("\n", "");
        text = text.replace("\r", "");
        return text;
    }
761676
public Phrase process(String text) {
        int fsize = fonts.size();
        if (fsize == 0)
            throw new IndexOutOfBoundsException("No font is defined.");
        char cc[] = text.toCharArray();
        int len = cc.length;
        StringBuffer sb = new StringBuffer();
        Font font = null;
        int lastidx = -1;
        Phrase ret = new Phrase();
        for (int k = 0; k < len; ++k) {
            char c = cc[k];
            if (c == '\n' || c == '\r') {
                sb.append(c);
                continue;
            }
            if (Utilities.isSurrogatePair(cc, k)) {
                int u = Utilities.convertToUtf32(cc, k);
                for (int f = 0; f < fsize; ++f) {
                    font = (Font)fonts.get(f);
                    if (font.getBaseFont().charExists(u)) {
                        if (lastidx != f) {
                            if (sb.length() > 0 && lastidx != -1) {
                                Chunk ck = new Chunk(sb.toString(), (Font)fonts.get(lastidx));
                                ret.add(ck);
                                sb.setLength(0);
                            }
                            lastidx = f;
                        }
                        sb.append(c);
                        sb.append(cc[++k]);
                        break;
                    }
                }
            }
            else {
                for (int f = 0; f < fsize; ++f) {
                    font = (Font)fonts.get(f);
                    if (font.getBaseFont().charExists(c)) {
                        if (lastidx != f) {
                            if (sb.length() > 0 && lastidx != -1) {
                                Chunk ck = new Chunk(sb.toString(), (Font)fonts.get(lastidx));
                                ret.add(ck);
                                sb.setLength(0);
                            }
                            lastidx = f;
                        }
                        sb.append(c);
                        break;
                    }
                }
            }
        }
        if (sb.length() > 0) {
            Chunk ck = new Chunk(sb.toString(), (Font)fonts.get(lastidx == -1 ? 0 : lastidx));
            ret.add(ck);
        }
        return ret;
    }
479662
private static String unescapeLiteral(final String text) {

        if (text == null) {
            return null;
        }

        StringBuilder strBuilder = null;

        final int max = text.length();

        int readOffset = 0;
        int referenceOffset = 0;

        char c;

        for (int i = 0; i < max; i++) {

            c = text.charAt(i);

            /*
             * Check the need for an unescape operation at this point
             */

            if (c != ESCAPE_PREFIX || (i + 1) >= max) {
                continue;
            }

            if (c == ESCAPE_PREFIX) {

                switch (text.charAt(i + 1)) {
                    case '\'': c = '\''; referenceOffset = i + 1; break;
                    case '\\': c = '\\'; referenceOffset = i + 1; break;
                    // We weren't able to consume any valid escape chars, just not consider it an escape operation
                    default: referenceOffset = i; break;
                }

            }


            /*
             * At this point we know for sure we will need some kind of unescape, so we
             * can increase the offset and initialize the string builder if needed, along with
             * copying to it all the contents pending up to this point.
             */

            if (strBuilder == null) {
                strBuilder = new StringBuilder(max + 5);
            }

            if (i - readOffset > 0) {
                strBuilder.append(text, readOffset, i);
            }

            i = referenceOffset;
            readOffset = i + 1;

            /*
             * Write the unescaped char
             */
            strBuilder.append(c);

        }


        /*
         * -----------------------------------------------------------------------------------------------
         * Final cleaning: return the original String object if no unescape was actually needed. Otherwise
         *                 append the remaining escaped text to the string builder and return.
         * -----------------------------------------------------------------------------------------------
         */

        if (strBuilder == null) {
            return text;
        }

        if (max - readOffset > 0) {
            strBuilder.append(text, readOffset, max);
        }

        return strBuilder.toString();

    }
1098055
public static String trimAndNullIfEmpty(final String text) {
        if (text != null && !text.trim().isEmpty()) {
            return text.trim();
        }
        return null;
    }
1152303
protected String formatPlaceholderText(String text) {
        String formattedText = (null != text) ? text.trim() : null;
        int length = (null != formattedText) ? formattedText.length() : 0;
        if (length > 0) {
            return formattedText.substring(0, Math.min(2, length)).toUpperCase(Locale.getDefault());
        }
        return null;
    }
41464
public static String unescape(String text) {
        StringBuilder builder = new StringBuilder();
        boolean foundQuote = false;

        for (int i = 0; i < text.length(); i++) {
            char c = text.charAt(i);

            if (i == 0 && c == QUOTE || i == text.length() - 1 && c == QUOTE) {
                continue;
            }

            if (c == QUOTE) {
                if (foundQuote) {
                    builder.append(QUOTE);
                    foundQuote = false;
                } else {
                    foundQuote = true;
                }
            } else {
                foundQuote = false;
                builder.append(c);
            }
        }

        return builder.toString();
    }
1026992
public String endsWith(final CharSequence text) {
		if (dialect == null) {
			throw new IllegalStateException("dialect is not set.");
		}
		if (StringUtils.isEmpty(text)) {
			return "%";
		} else {
			return "%" + dialect.escapeLikePattern(text);
		}
	}
679257
private String filterWhitespace(String text) {
        text = text.replace("\n", " ");
        text = text.replaceAll(" {2,}", " ");
        text = XmlEscape.escape(text);
        return text.trim();
    }
813152
public String senSegment(String text){
		String ret = text;
		
		//Segment sentences
		if (vnSenSegmenter != null){
			ret = vnSenSegmenter.senSegment(text);
		}
		
		return ret.trim();
	}
1115872
public QRSCT text(String text) {
		if (text != null && text.length() <= 140) {
			this.reference = ""; //$NON-NLS-1$
			this.text = checkValidSigns(text);
			return this;
		}
		throw new IllegalArgumentException("supplied text [" + text //$NON-NLS-1$
				+ "] not valid: has to be not null and of max length 140"); //$NON-NLS-1$
	}
439936
public static String removeQuotes(String s) {
        if (s == null) return null;

        s = s.trim();
        if (s.startsWith("\"")) s = s.substring(1);
        if (s.endsWith("\"")) s = s.substring(0, s.length() - 1);

        return s;
    }
842151
public String protectKeyword(String text) {
		if (!Strings.isEmpty(text) && isKeyword(text)) {
			return "^" + text;
		}
		return text;
	}
696573
function stripQuotes(text) {
  var sansquotes = text;
  if(isQuotedString(text)) {
    if(text.length === 2) {
        sanquotes = ""; // empty string
    }
    else {
      sansquotes = text.substring(1, text.length-1);
// DELETE?      sansquotes = unescapeQuotes(sansquotes);
    }
  }
  return sansquotes;
}