One way to get the first 3 characters and last 5 characters in a string in Swift is by using the prefix(_:) and suffix(_:) methods:
main.swift119 chars4 linesAnother way to achieve the same result is by using the dropLast(_:) and prefix(_:) methods:
main.swift139 chars4 linesNote that dropFirst(_:) or dropLast(_:) should be used with caution, since they may trigger a runtime error if the string is shorter than the specified number of characters.
gistlibby LogSnag