Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

index string swift

let string = "Hello, World!"
let index = string.index(string.startIndex, offsetBy: 3)

print(string[index]) // Prints "l"

// This can be done in one line too:
print(string[string.index(string.startIndex, offsetBy: 3)])
 
PREVIOUS NEXT
Tagged: #index #string #swift
ADD COMMENT
Topic
Name
6+8 =