Swift String initializers? -
i came across these 2 statements in swift teaching book.
let padding = string(count: spaces, repeatedvalue: character(" "))
println(string(format:"%@%@", "year", "test"))
my questions are:
- are both
string(count:repeatedvalue:)
,string(format:)
initializers of
string? - i not able find online documentation
string(format:)
can please suggest links? - what other initializers of string available? can find
init()
,init(count:repeatedvalue)
in apple documentation
thank much.
string structure in swift. can documentation in xcode itself.
here below details.
/// objective-c bridge /// ================== /// ///
string
bridged objective-cnsstring
, ,string
/// originated in objective-c may store characters in ///nsstring
. since arbitrary subclass ofnssstring
can /// becomestring
, there no guarantees representation or /// efficiency in case. sincensstring
immutable, /// though storage shared copy: first in /// sequence of mutating operations causes elements copied /// unique, contiguous storage may costo(n)
time , /// space,n
length of string representation (or /// more, if underlyingnsstring
has unusual performance /// characteristics).
struct string { init() }
here extension string.
extension string { /// construct instance concatenation of `sz` copies /// of `repeatedvalue` init(count sz: int, repeatedvalue c: character) /// construct instance concatenation of `sz` copies /// of `character(repeatedvalue)` init(count: int, repeatedvalue c: unicodescalar) /// `true` iff `self` contains no characters. var isempty: bool { } }
Comments
Post a Comment