blob: 2906e013da67cae72d0fd84becd92a41cdb4300f [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<title>String Extension Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script type="text/javascript">
window.jazzy = {'docset': false}
if (typeof window.dash != 'undefined') {
document.documentElement.className += ' dash'
window.jazzy.docset = true
}
if (navigator.userAgent.match(/xcode/i)) {
document.documentElement.className += ' xcode'
window.jazzy.docset = true
}
</script>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body id="reference" class="Swift">
<a name="//apple_ref/swift/Extension/String" class="dashAnchor"></a>
<a title="String Extension Reference"></a>
<header>
<div class="content-wrapper">
<p class="header-text"><a href="../index.html"> Docs</a> (41% documented)</p>
<p id="header-links"><a href=""><img id="header-icon" src="../img/gh.png" height="16px" width="16px" />View on GitHub</a></p>
</div>
</header>
<section id="valence">
<div class="content-wrapper">
<p id="hierarchial_navigation">
<a href="../index.html" id="design_resources_link"> Reference</a>
<img id="carat" src="../img/carat.png" height="10px" width="6px" />
String Extension Reference
</p>
</div>
</section>
<div class="content-wrapper">
<nav class="book-parts">
<ul class="nav-parts">
<li class="part-name tasks">
<a href="../Classes.html">Classes</a>
<ul class="nav-chapters">
<li class="nav-chapter">
<a href="../Classes/BaseClient.html">BaseClient</a>
</li>
<li class="nav-chapter">
<a href="../Classes/EngineClient.html">EngineClient</a>
</li>
<li class="nav-chapter">
<a href="../Classes/EventClient.html">EventClient</a>
</li>
<li class="nav-chapter">
<a href="../Classes/Manager.html">Manager</a>
</li>
<li class="nav-chapter">
<a href="../Classes/Request.html">Request</a>
</li>
</ul>
</li>
<li class="part-name tasks">
<a href="../Global Variables.html">Global Variables</a>
<ul class="nav-chapters">
<li class="nav-chapter">
<a href="../Global Variables.html#/s:v15PredictionIOSDK20AlamofireErrorDomainSS">AlamofireErrorDomain</a>
</li>
</ul>
</li>
<li class="part-name tasks">
<a href="../Enums.html">Enums</a>
<ul class="nav-chapters">
<li class="nav-chapter">
<a href="../Enums.html#/s:O15PredictionIOSDK6Method">Method</a>
</li>
<li class="nav-chapter">
<a href="../Enums/ParameterEncoding.html">ParameterEncoding</a>
</li>
</ul>
</li>
<li class="part-name tasks">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-chapters">
<li class="nav-chapter">
<a href="../Extensions/EventClient.html">EventClient</a>
</li>
<li class="nav-chapter">
<a href="../Extensions/Manager.html">Manager</a>
</li>
<li class="nav-chapter">
<a href="../Extensions/NSURL.html">NSURL</a>
</li>
<li class="nav-chapter">
<a href="../Extensions/NSURLComponents.html">NSURLComponents</a>
</li>
<li class="nav-chapter">
<a href="../Extensions/NSURLRequest.html">NSURLRequest</a>
</li>
<li class="nav-chapter">
<a href="../Extensions/Request.html">Request</a>
</li>
<li class="nav-chapter">
<a href="../Extensions/String.html">String</a>
</li>
</ul>
</li>
<li class="part-name tasks">
<a href="../Functions.html">Functions</a>
<ul class="nav-chapters">
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK8downloadFTPS_21URLRequestConvertible_FTCSo5NSURLCSo17NSHTTPURLResponse_S1__CS_7Request">download(_:_:)</a>
</li>
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK8downloadFTOS_6MethodPS_20URLStringConvertible_FTCSo5NSURLCSo17NSHTTPURLResponse_S2__CS_7Request">download(_:_:_:)</a>
</li>
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK8downloadFT10resumeDataCSo6NSDataFTCSo5NSURLCSo17NSHTTPURLResponse_S1__CS_7Request">download(resumeData:_:)</a>
</li>
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK7requestFPS_21URLRequestConvertible_CS_7Request">request(_:)</a>
</li>
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK7requestFTOS_6MethodPS_20URLStringConvertible_10parametersGSqGVSs10DictionarySSPSs9AnyObject___8encodingOS_17ParameterEncoding_CS_7Request">request(_:_:parameters:encoding:)</a>
</li>
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK6uploadFTPS_21URLRequestConvertible_CSo6NSData_CS_7Request">upload(_:_:)</a>
</li>
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK6uploadFTPS_21URLRequestConvertible_CSo13NSInputStream_CS_7Request">upload(_:_:)</a>
</li>
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK6uploadFTPS_21URLRequestConvertible_CSo5NSURL_CS_7Request">upload(_:_:)</a>
</li>
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK6uploadFTOS_6MethodPS_20URLStringConvertible_CSo13NSInputStream_CS_7Request">upload(_:_:_:)</a>
</li>
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK6uploadFTOS_6MethodPS_20URLStringConvertible_CSo5NSURL_CS_7Request">upload(_:_:_:)</a>
</li>
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK6uploadFTOS_6MethodPS_20URLStringConvertible_CSo6NSData_CS_7Request">upload(_:_:_:)</a>
</li>
</ul>
</li>
<li class="part-name tasks">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-chapters">
<li class="nav-chapter">
<a href="../Protocols/URLRequestConvertible.html">URLRequestConvertible</a>
</li>
<li class="nav-chapter">
<a href="../Protocols/URLStringConvertible.html">URLStringConvertible</a>
</li>
</ul>
</li>
<li class="part-name tasks">
<a href="../Structs.html">Structs</a>
<ul class="nav-chapters">
<li class="nav-chapter">
<a href="../Structs/Event.html">Event</a>
</li>
</ul>
</li>
</ul>
</nav>
<div class="pixel-line"></div>
<div class="rubber-band-gap"></div>
<article class="chapter">
<a name="/"></a>
<h1 class="chapter-name">String</h1>
<section>
<section class="section">
<p class="para">An arbitrary Unicode string value.Unicode-Correct ===============Swift strings are designed to be Unicode-correct. In particular, the APIs make it easy to write code that works correctly, and does not surprise end-users, regardless of where you venture in the Unicode character space. For example,<ul><li>The <code>==</code> operator checks for Unicode canonical equivalence, so two different representations of the same string will always compare equal.</li><li>String elements are <code>Characters</code> (Unicode extended grapheme clusters), a unit of text that is meaningful to most humans.</li></ul>Locale-Insensitive ==================The fundamental operations on Swift strings are not sensitive to locale settings. That&rsquo;s because, for example, the validity of a <code>Dictionary&lt;String, T&gt;</code> in a running program depends on a given string comparison having a single, stable result. Therefore, Swift always uses the default, un-tailored Unicode algorithms for basic string operations.Importing <code>Foundation</code> endows swift strings with the full power of the <code>NSString</code> API, which allows you to choose more complex locale-sensitive operations explicitly.Value Semantics ===============Each string variable, <code>let</code> binding, or stored property has an independent value, so mutations to the string are not observable through its copies::<blockquote>var a = <q>foo</q> var b = a b[b.endIndex.predecessor()] = <q>x</q> println(<q>a=\(a), b=\(b)</q>) // a=foo, b=fox</blockquote>Strings use Copy-on-Write so that their data is only copied lazily, upon mutation, when more than one string instance is using the same buffer. Therefore, the first in any sequence of mutating operations may cost <code>O(N)</code> time and space, where <code>N</code> is the length of the string&rsquo;s (unspecified) underlying representation,.Growth and Capacity ===================When a string&rsquo;s contiguous storage fills up, new storage must be allocated and characters must be moved to the new storage. <code>String</code> uses an exponential growth strategy that makes <code>append</code> a constant time operation <em>when amortized over many invocations</em>.Objective-C Bridge ==================<code>String</code> is bridged to Objective-C as <code>NSString</code>, and a <code>String</code> that originated in Objective-C may store its characters in an <code>NSString</code>. Since any arbitrary subclass of <code>NSSString</code> can become a <code>String</code>, there are no guarantees about representation or efficiency in this case. Since <code>NSString</code> is immutable, it is just as though the storage was shared by some copy: the first in any sequence of mutating operations causes elements to be copied into unique, contiguous storage which may cost <code>O(N)</code> time and space, where <code>N</code> is the length of the string representation (or more, if the underlying <code>NSString</code> is has unusual performance characteristics).</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<div class="task-name-container">
<a name="/Unnamed"></a>
</div>
<ul class="task-group-list">
<li class="item symbol">
<div class="task-group-term">
<code>
<a name="/s:vE15PredictionIOSDKSS9URLStringSS">
<a name="//apple_ref/swift/Property/URLString" class="dashAnchor"></a>
<a class="x-instance-method Swift" href="#/s:vE15PredictionIOSDKSS9URLStringSS">URLString</a>
</code>
</div>
<div class="height-container">
<div class="pointy-thing-container"></div>
<section class="section instance-method">
<div class="pointy-thing"></div>
<div class="abstract">
<p class="para">Undocumented</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p class="copyright">&copy; 2015 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2015-02-24)</p>
<p class="copyright">Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.1.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>