OSDN Git Service

libgo: Update to weekly.2011-12-06.
[pf3gnuchains/gcc-fork.git] / libgo / go / strconv / quote.go
index 9b48c07..30b384d 100644 (file)
@@ -92,6 +92,12 @@ func Quote(s string) string {
        return quoteWith(s, '"', false)
 }
 
+// AppendQuote appends a double-quoted Go string literal representing s,
+// as generated by Quote, to dst and returns the extended buffer.
+func AppendQuote(dst []byte, s string) []byte {
+       return append(dst, Quote(s)...)
+}
+
 // QuoteToASCII returns a double-quoted Go string literal representing s.
 // The returned string uses Go escape sequences (\t, \n, \xFF, \u0100) for
 // non-ASCII characters and non-printable characters as defined by
@@ -100,6 +106,12 @@ func QuoteToASCII(s string) string {
        return quoteWith(s, '"', true)
 }
 
+// AppendQuoteToASCII appends a double-quoted Go string literal representing s,
+// as generated by QuoteToASCII, to dst and returns the extended buffer.
+func AppendQuoteToASCII(dst []byte, s string) []byte {
+       return append(dst, QuoteToASCII(s)...)
+}
+
 // QuoteRune returns a single-quoted Go character literal representing the
 // rune.  The returned string uses Go escape sequences (\t, \n, \xFF, \u0100)
 // for control characters and non-printable characters as defined by
@@ -109,6 +121,12 @@ func QuoteRune(rune int) string {
        return quoteWith(string(rune), '\'', false)
 }
 
+// AppendQuoteRune appends a single-quoted Go character literal representing the rune,
+// as generated by QuoteRune, to dst and returns the extended buffer.
+func AppendQuoteRune(dst []byte, rune int) []byte {
+       return append(dst, QuoteRune(rune)...)
+}
+
 // QuoteRuneToASCII returns a single-quoted Go character literal representing
 // the rune.  The returned string uses Go escape sequences (\t, \n, \xFF,
 // \u0100) for non-ASCII characters and non-printable characters as defined
@@ -118,6 +136,12 @@ func QuoteRuneToASCII(rune int) string {
        return quoteWith(string(rune), '\'', true)
 }
 
+// AppendQuoteRune appends a single-quoted Go character literal representing the rune,
+// as generated by QuoteRuneToASCII, to dst and returns the extended buffer.
+func AppendQuoteRuneToASCII(dst []byte, rune int) []byte {
+       return append(dst, QuoteRuneToASCII(rune)...)
+}
+
 // CanBackquote returns whether the string s would be
 // a valid Go string literal if enclosed in backquotes.
 func CanBackquote(s string) bool {