9
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Swift]Stringクラスのメソッド[メモ]

Last updated at Posted at 2014-06-09

自分のための覚書。
型がよくわからないところは???にしています。

間違ってるかもしれませんので、気づいた方はよかったらコメントで指摘してください。

https://developer.apple.com/library/prerelease/ios/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/
にNSStringクラスのSwift用のリファレンスもあるけど、Stringクラスとは微妙に違うっぽい。

クラス・メソッド

availableStringEncoding()

  • availableStringEncoding() -> NSStringEncoding[]

bridgeFromObjectiveC(x: NSString)

  • bridgeFromObjectiveC(x: NSString) -> String?

bridgeToObjectiveC(self: String)

  • bridgeToObjectiveC(self: String) -> () -> NSString

canBeConvertedToEncoding(self: String)

  • canBeConvertedToEncoding(self: String) -> (NSStringEncoding) -> Bool

String capitalizedStringWithLocale(self: String)

  • capitalizedStringWithLocale(self: String) -> NSLocale

caseInsensitiveCompare(self: String)

  • caseInsensitiveCompare(self: String) -> (String) -> NSComparisonResult

commonPrefixWithString(self: String)

  • commonPrefixWithString(self: String) -> (String, options: NSStringCompareOptions) -> String

compare(self: String)

  • compare(self: String) -> (String, options: NSStringCompareOptions) -> Int
  • compare(self: String) -> (String) -> Int

(まだ途中)

インスタンス・メソッド と プロパティ

bringToObjectiveC()

  • bringToObjectiveC() -> NSString

canBeConvertedToEncoding(encoding: NSStringEncoding)

  • canBeConvertedToEncoding(encoding: NSStringEncoding) -> Bool

capitalizedString

  • capitalizedString -> String

capitalizedStringWithLocale(locale: NSLocale)

  • capitalizedStringWithLocale(locale: NSLocale) -> String

caseInsensitiveCompare(aString: String)

  • caseInsensitiveCompare(aString: String) -> NSComparisonResult

commonPrefixWithString(aString: String, options: NSStringCompareOptions)

  • commonPrefixWithString(aString: String, options: NSStringCompareOptions) -> String

compare(aString: String, options: NSStringCompareOptions, range: Range?, locale: NSLocale?)

  • compare(aString: String, options: NSStringCompareOptions, range: Range?, locale: NSLocale?) -> NSComparisonResult

compare(other: String)

  • compare(other: String) -> Int

completePathIntoString(outputName: CMutablePointer, caseSensitive: Bool, matchesIntoArray: CMutablePointer, filterTypes: String[]?)

  • completePathIntoString(outputName: CMutablePointer, caseSensitive: Bool, matchesIntoArray: CMutablePointer, filterTypes: String[]?) -> Int

componentSeparatedByCharactersInSet(separator: String)

  • componentSeparatedByCharactersInSet(separator: String) -> String[]

componentSeparatedByString(separator: String)

  • componentSeparatedByString(separator: String) -> String[]

cStringUsingEncoding(encoding: NSStringEncoding)

  • cStringUsingEncoding(encoding: NSStringEncoding) -> CChar[]?

dataUsingEncoding(encoding: NSStringEncoding, allowLossyConversion: Bool)

  • dataUsingEncoding(encoding: NSStringEncoding, allowLossyConversion: Bool) -> NSData

debugDescription

  • debugDescription -> String

decompressedStringWithCanonicaMapping

  • decompressedStringWithCanonicaMapping -> String

decompressedStringWithCompatibilityMapping

  • decompressedStringWithCompatibilityMapping -> String

endIndex

  • endIndex -> String.Index

enumerateLines(body: (line: String, input stop: Bool) ->())

  • enumerateLines(body: (line: String, input stop: Bool) ->()) -> Void

enumerateLinguisticTagsInRange(range: Range, scheme: String, options: NSLinguisticTaggerOptions, orthography: NSOrthography?, body: (String, Range, Range, inout Bool) -> ())

  • enumerateLinguisticTagsInRange(range: Range, scheme: String, options: NSLinguisticTaggerOptions, orthography: NSOrthography?, body: (String, Range, Range, inout Bool) -> ()) -> Void

enumerateSubstringsInRange(range: Range#>, options: NSStringEnumerationOptions, body: (substring: String, substringRange: Range, enclosingRange: Range, inout Bool) -> ())

  • enumerateSubstringsInRange(range: Range#>, options: NSStringEnumerationOptions, body: (substring: String, substringRange: Range, enclosingRange: Range, inout Bool) -> ()) -> Void

extend(seq: S)

  • extend(seq: S) -> Void

fastestEncoding

  • fastestEncoding -> NSStringEncoding

fileSystemRepresentation()

  • fileSystemRepresentation() -> CChar[]

generate()

  • generate() -> IndexingGenerator

getBytes(&buffer: UInt8[], maxLength: Int, usedLength: CMutablePointer, encoding: NSStringEncoding, options: NSStringEncodingConversionOptions, range: Range, remainingRange: CMutablePointer>)

  • getBytes(&buffer: UInt8[], maxLength: Int, usedLength: CMutablePointer, encoding: NSStringEncoding, options: NSStringEncodingConversionOptions, range: Range, remainingRange: CMutablePointer>) -> Bool

getCString(&buffer: CChar[], maxLength: Int, encoding: NSStringEncoding)

  • getCString(&buffer: CChar[], maxLength: Int, encoding: NSStringEncoding) -> Bool

getFileSystemRepresentation(&buffer: CChar[], maxLength: Int)

  • getFileSystemRepresentation(&buffer: CChar[], maxLength: Int) -> Bool

getLineStart(start: CMutablePointer, end: CMutablePointer, contentsEnd: CMutablePointer, forRange: Range)

  • getLineStart(start: CMutablePointer, end: CMutablePointer, contentsEnd: CMutablePointer, forRange: Range) -> Void

getMirror()

  • getMirror() -> Mirror

getParagraphStart(start: CMutablePointer, end: CMutablePointer, contentsEnd: CMutablePointer, forRange: Range)

  • getParagraphStart(start: CMutablePointer, end: CMutablePointer, contentsEnd: CMutablePointer, forRange: Range) -> Void

hash

  • hash -> Int

hashValue

  • hashValue -> Int

hasPrefix(prefix: String)

  • hasPrefix(prefix: String) -> Bool

hasSuffix(suffix: String)

  • hasSuffix(suffix: String) -> Bool

isEmpty

  • isEmpty -> Bool

join(elements: S)

  • join(elements: S) -> String

lastPathComponent

  • lastPathComponent -> String

lengthOfBytesUsingEncoding(encoding: NSStringEncoding)

  • lengthOfBytesUsingEncoding(encoding: NSStringEncoding) -> Int

lineRangeForRange(aRange: Range)

  • lineRangeForRange(aRange: Range) -> Range

linguisticTagsInRange(range: Range, scheme: String, options: NSLinguisticTaggerOptions, orthography: NSOrthography?, tokenRanges: CMutablePointer[]>)

  • linguisticTagsInRange(range: Range, scheme: String, options: NSLinguisticTaggerOptions, orthography: NSOrthography?, tokenRanges: CMutablePointer[]>) -> String[]

localizedCaseInsensitiveCompare(aString: String)

  • localizedCaseInsensitiveCompare(aString: String) -> NSComparisonResult

localizedCompare(aString: String)

  • localizedCompare(aString: String) -> NSComparisonResult

localizedStandardCompare(string: String)

  • localizedStandardCompare(string: String) -> NSComparisonResult

lowercaseString

  • lowercaseString -> String

lowercaseStringWithLocale(locale: NSLocale)

  • lowercaseStringWithLocale(locale: NSLocale) -> String

maximumLengthOfBytesUsingEncoding(encoding: NSStringEncoding)

  • maximumLengthOfBytesUsingEncoding(encoding: NSStringEncoding) -> Int

nulTerminatedUTF8

  • nulTerminatedUTF8 -> ContiguousArray

paragraphRangeForRange(aRange: Range)

  • paragraphRangeForRange(aRange: Range) -> Range

pathComponents

  • pathComponents -> String[]

pathExtension

  • pathExtension -> String

precomposedStringWithCanonicalMapping

  • precomposedStringWithCanonicalMapping -> String

precomposedStringWithCompatibilityMapping

  • precomposedStringWithCompatibilityMapping -> String

propertyList()

  • propertyList() -> AnyObject

propertyListFromStringFileFormat()

  • propertyListFromStringFileFormat() -> Dictionary

rangeOfCharacterFromSet(aSet: NSCharacterSet, options: NSStringCompareOptions, range: Range?)

  • rangeOfCharacterFromSet(aSet: NSCharacterSet, options: NSStringCompareOptions, range: Range?) -> Range

rangeOfComposedCharacterSequenceAtIndex(anIndex: String.Index)

  • rangeOfComposedCharacterSequenceAtIndex(anIndex: String.Index) -> Range

rangeOfComposedCharacterSequenceForRange(range: Range)

  • rangeOfComposedCharacterSequenceForRange(range: Range) -> Range

rangeOfString(aString: String, options: NSStringCompareOptions, range: Range?, locale: NSLocale?)

  • rangeOfString(aString: String, options: NSStringCompareOptions, range: Range?, locale: NSLocale?) -> Range

reserveCapacity(n: Int)

  • reserveCapacity(n: Int) -> Void

smallestEncoding

  • smallestEncoding -> NSStringEncoding

startIndex

  • startIndex -> String.Index

stringByAbbreviatingWithTildeInPath()

  • stringByAbbreviatingWithTildaInPath() -> String

stringByAddingPercentEncodingWithAllowedCharacters(allowedCharacters: NSCharacterSet)

  • stringByAddingPercentEncodingWithAllowedCharacters(allowedCharacters: NSCharacterSet) -> String

stringByAddingPercentEscapesUsingEncoding(encoding: NSStringEncoding)

  • stringByAddingPercentEscapesUsingEncoding(encoding: NSStringEncoding) -> String

stringByAppendingFormat(format: String, arguments: CVarArg[])

  • stringByAppendingFormat(format: String, arguments: CVarArg[]) -> String

stringByAppendingPathComponent(aString: String)

  • stringByAppendingPathComponent(aString: String) -> String

stringByAppendingPathExtension(ext: String)

  • stringByAppendingPathExtension(ext: String) -> String

stringByAppendingString(aString: String)

  • stringByAppendingString(aString: String) -> String

stringByDeletingLastPathComponent

  • stringByDeletingLastPathComponent -> String

stringByDeletingPathExtension

  • stringByDeletingPathExtension -> String

stringByExpandingTildeInPath

  • stringByExpandingTildeInPath -> String

stringByFoldingWithOptions(options: NSStringCompareOptions, locale: NSLocale)

  • stringByFoldingWithOptions(options: NSStringCompareOptions, locale: NSLocale) -> String

stringPaddingToLength(newLength: Int, withString: String, startingAtIndex: Int)

  • stringPaddingToLength(newLength: Int, withString: String, startingAtIndex: Int) -> String

stringByRemovingPercentEncoding

  • stringByRemovingPercentEncoding -> String

stringByReplacingCharactersInRange(range: Range, withString: String)

  • stringByReplacingCharactersInRange(range: Range, withString: String) -> String

stringByReplacingOccurrencesOfString(target: String, withString: String, options: NSStringCompareOptions, range: Range?)

  • stringByReplacingOccurrencesOfString(target: String, withString: String, options: NSStringCompareOptions, range: Range?) -> String

stringByReplacingPercentEscapesUsingEncoding(encoding: NSStringEncoding)

  • stringByReplacingPercentEscapesUsingEncoding(encoding: NSStringEncoding) -> String

stringByResolvingSymlinkInPath

  • stringByResolvingSymlinkInPath -> String

stringByStandardizingPath

  • stringByStandardizingPath -> String

stringByTrimmingCharactersInSet(set: NSCharacterSet)

  • stringByTrimmingCharactersInSet(set: NSCharacterSet) -> String

stringsByAppendingPaths(paths: String[])

  • stringByAppendingPaths(paths: String[]) -> String[]

substringFromIndex(index: Int)

  • substringFromIndex(index: Int) -> String

substringToIndex(index: Int)

  • substringToIndex(index: Int) -> String

substringWithRange(aRange: Range)

  • substringWithRange(aRange: Range) -> String

toInt()

  • toInt() -> Int?

unicodeScalars

  • unicodeScalars -> String.UnicodeScalarView

uppercaseString

  • uppercaseString -> String

uppercaseStringWithLocale(locale: NSLocale)

  • uppercaseStringWithLocale(locale: NSLocale) -> String

utf16

  • utf16 -> String.UTF16View

utf16count

  • utf16count -> Int

utf8

  • utf8 -> String.UTF8View

withCString(f: (CString) -> Result)

  • withCString(f: (CString) -> Result) -> Result

withCString(f: (UnsafePointer) -> Result)

  • withCString(f: (UnsafePointer) -> Result) -> Result

write(string: String)

  • write(string: String) -> Void

writeTo(&target: Target)

  • writeTo(&target: Target) -> Void

writeTofile(path: String, atomically: Bool, encoding: NSStringEncoding, error: NSErrorPointer)

  • writeTofile(path: String, atomically: Bool, encoding: NSStringEncoding, error: NSErrorPointer) -> Bool

writeToURL(url: NSURL, atomically: Bool, encoding: NSStringEncoding, error: NSErrorPointer)

  • writeToURL(url: NSURL, atomically: Bool, encoding: NSStringEncoding, error: NSErrorPointer) -> Bool
9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?