Skip to content
This repository has been archived by the owner on Mar 29, 2018. It is now read-only.

Latest commit

 

History

History
62 lines (50 loc) · 909 Bytes

String.md

File metadata and controls

62 lines (50 loc) · 909 Bytes

#String

Contents

Instance Methods

length
"Hi".length() 
// → 2
explode
let string = "A B C"
string.explode(" ")
// → ["A", "B", "C"]

Class Methods

random
String.random(length: 5)
// → fja92

Operators

Subscript

let str = "Hello"
println(str[1])
// → e

Subscript with Range

let str = "Hello"

println(str[0..2])
// → He

println(str[0...2])
// → Hel

Multiplication

println("A" * 3)
// → AAA