Brooklyn

brooklyn.util.text
[Java] Class StringEscapes

java.lang.Object
  brooklyn.util.text.StringEscapes

public class StringEscapes

Nested Class Summary
static class StringEscapes.BashStringEscapes

static class StringEscapes.JavaStringEscapes

 
Method Summary
static java.lang.String escapeHtmlFormUrl(java.lang.String url)

Encodes a string suitable for use as a URL in an HTML form: space to +, and high-numbered chars assuming UTF-8.

static java.lang.String escapeSql(java.lang.String x)

encodes a string to SQL, that is ' becomes ''

static java.lang.String escapeUrlParam(java.lang.String input)

Encodes a string suitable for use as a parameter in a URL.

static boolean isWrappedInDoubleQuotes(java.lang.String s)

if s is wrapped in double quotes containing no unescaped double quotes

static boolean isWrappedInMatchingQuotes(java.lang.String s)

if s is wrapped in single or double quotes containing no unescaped quotes of that type

static boolean isWrappedInSingleQuotes(java.lang.String s)

if s is wrapped in single quotes containing no unescaped single quotes

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Method Detail

escapeHtmlFormUrl

public static java.lang.String escapeHtmlFormUrl(java.lang.String url)
Encodes a string suitable for use as a URL in an HTML form: space to +, and high-numbered chars assuming UTF-8. However, it will also convert the first "http://" to "http%3A%2F%2F" so is not suitable for converting an entire URL. Also note that parameter-conversion doesn't work in way you'd expect when trying to create a "normal" url. See http://stackoverflow.com/questions/724043/http-url-address-encoding-in-java
See Also:
escapeUrlParam(java.lang.String)


escapeSql

public static java.lang.String escapeSql(java.lang.String x)
encodes a string to SQL, that is ' becomes ''


escapeUrlParam

public static java.lang.String escapeUrlParam(java.lang.String input)
Encodes a string suitable for use as a parameter in a URL.


isWrappedInDoubleQuotes

public static boolean isWrappedInDoubleQuotes(java.lang.String s)
if s is wrapped in double quotes containing no unescaped double quotes


isWrappedInMatchingQuotes

public static boolean isWrappedInMatchingQuotes(java.lang.String s)
if s is wrapped in single or double quotes containing no unescaped quotes of that type


isWrappedInSingleQuotes

public static boolean isWrappedInSingleQuotes(java.lang.String s)
if s is wrapped in single quotes containing no unescaped single quotes


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.