Skip to content

String

Manipulation

Substring

Type conversion to String HWS

Print

Printing boolean values in print statement wasn’t straight forward as I believed it was. So we can encapsulate the boolean value in string and print it.

SO

nth element

Very useful thread for getting character of string in swift, playing with its index values rather than just value of the string character.

SO

Simple Swift guide

Range

SO

Computed string _ closure

Pass parametric property like behavior but Swift doesn't allow for parameters to be passed to properties. So we would use function - closure(nameless function) to achieve the same goal.

var image_: (String) -> String {
    { "image-\($0)" }
}
// Call
print(image_("3"))

Deprecations

String interpolation Debug description