[stdlib] Fixed bugs with string views

Fixes rdar://problem/18435682
Fixes rdar://problem/19238102

Swift SVN r24117
This commit is contained in:
Maxwell Swadling
2014-12-23 20:02:38 +00:00
parent 1486238412
commit 02808373d8
5 changed files with 94 additions and 10 deletions

View File

@@ -28,7 +28,8 @@ extension String {
/// A collection of `Unicode scalar values
/// <http://www.unicode.org/glossary/#unicode_scalar_value>`_ that
/// encode a `String` .
public struct UnicodeScalarView : Sliceable, SequenceType, Reflectable {
public struct UnicodeScalarView : Sliceable, SequenceType, Reflectable,
Printable, DebugPrintable {
init(_ _core: _StringCore) {
self._core = _core
}
@@ -210,6 +211,14 @@ extension String {
return _UnicodeScalarViewMirror(self)
}
public var description: String {
return String(_core[self.startIndex._position..<self.endIndex._position])
}
public var debugDescription: String {
return "StringUnicodeScalarView(\(self.description.debugDescription))"
}
var _core: _StringCore
}