struct
String.UnicodeScalarView
Inheritance |
CollectionType, DebugPrintable, ExtensibleCollectionType, Printable, RangeReplaceableCollectionType, Reflectable, SequenceType, Sliceable, _CollectionType, _ExtensibleCollectionType, _SequenceType, _Sequence_Type, _Sliceable
View Protocol Hierarchy →
|
---|---|
Associated Types |
Type alias inferred.
Type alias inferred.
Type alias inferred.
Type alias inferred. |
Nested Types | String.UnicodeScalarView.Index, String.UnicodeScalarView.Generator |
Import |
|
Initializers
Construct an empty instance.
Declaration
init
()
Instance Variables
Declaration
var
debugDescription
:
String
{
get
}
Declaration
var
description
:
String
{
get
}
The "past the end" position.
endIndex
is not a valid argument to subscript
, and is always
reachable from startIndex
by zero or more applications of
successor()
.
Declaration
var
endIndex
:
String.UnicodeScalarView.Index
{
get
}
The position of the first UnicodeScalar
if the String
is
non-empty; identical to endIndex
otherwise.
Declaration
var
startIndex
:
String.UnicodeScalarView.Index
{
get
}
Subscripts
Declaration
subscript
(
position
:
String.UnicodeScalarView.Index
) -
>
UnicodeScalar
{
get
}
Declaration
subscript
(
r
:
Range
<
String.UnicodeScalarView.Index
>
) -
>
String.UnicodeScalarView
{
get
}
Instance Methods
Append the elements of newElements
to self
.
Complexity: O(length of result)
Declaration
mutating
func
extend
<
S
:
SequenceType
where
UnicodeScalar
==
UnicodeScalar
>
(
newElements
:
S
)
Return a generator over the UnicodeScalar
s that comprise
this sequence.
Complexity: O(1)
Declaration
func
generate
() -
>
String.UnicodeScalarView.Generator
Insert newElement
at index i
.
Invalidates all indices with respect to self
.
Complexity: O(count(self)
).
Declaration
mutating
func
insert
(
newElement
:
UnicodeScalar
,
atIndex
i
:
String.UnicodeScalarView.Index
)
Remove all elements.
Invalidates all indices with respect to self
.
keepCapacity
, if true
, prevents the release of
allocated storage, which can be a useful optimization
when self
is going to be grown again.
Declaration
mutating
func
removeAll
(
keepCapacity
:
Bool
=
default
)
Remove the and return element at index i
Invalidates all indices with respect to self
.
Complexity: O(count(self)
).
Declaration
mutating
func
removeAtIndex
(
i
:
String.UnicodeScalarView.Index
) -
>
UnicodeScalar
Remove the indicated subRange
of elements
Invalidates all indices with respect to self
.
Complexity: O(count(self)
).
Declaration
mutating
func
removeRange
(
subRange
:
Range
<
String.UnicodeScalarView.Index
>
)
Replace the given subRange
of elements with newElements
.
Invalidates all indices with respect to self
.
Complexity: O(count(subRange)
) if subRange.endIndex
== self.endIndex
and isEmpty(newElements)
, O(N) otherwise.
Declaration
mutating
func
replaceRange
<
C
:
CollectionType
where
UnicodeScalar
==
UnicodeScalar
>
(
subRange
:
Range
<
String.UnicodeScalarView.Index
>
,
with
newElements
:
C
)
Reserve enough space to store n
ASCII characters.
Complexity: O(n
)
Declaration
mutating
func
reserveCapacity
(
n
:
Int
)
Insert newElements
at index i
Invalidates all indices with respect to self
.
Complexity: O(count(self) + count(newElements)
).
Declaration
mutating
func
splice
<
S
:
CollectionType
where
UnicodeScalar
==
UnicodeScalar
>
(
newElements
:
S
,
atIndex
i
:
String.UnicodeScalarView.Index
)
A collection of Unicode scalar values that encode a
String
.