stdlib/printing: add Streamable conformance to CString, and DebugPrintable

conformances to String and CString


Swift SVN r18003
This commit is contained in:
Dmitri Hrybenko
2014-05-13 13:54:43 +00:00
parent 4f921ad60b
commit ed68ba833f
4 changed files with 31 additions and 0 deletions

View File

@@ -88,6 +88,16 @@ extension String : StringLiteralConvertible {
}
}
extension String : DebugPrintable {
var debugDescription: String {
var result = "\""
for us in self.unicodeScalars {
result += us.escape()
}
result += "\""
return result
}
}
extension String {
/// \brief return the number of code units occupied by this string