Learn Python practically
and Get Certified.
Reference Materials
Learn Python Interactively
Try Programiz PROLearn Python practically
and Get Certified.
Try Programiz PRO!
Learn Python practically
and Get Certified.
Swift String Methods
Swift has a lot of String methods that allow us to work with strings. In this reference page, you will find all the string methods available in Swift. For example, if you need to add two strings, use the append() method.
Swift String append()
adds a string value to another string
Swift String elementsEqual()
checks if two strings are equal
Swift String hasPrefix()
checks if string begins with the specified string
Swift String hasSuffix()
checks if string ends with the specified string
Swift String insert()
inserts a new character value into the string
Swift String remove()
removes a character in the string
Swift String replacingOccurrences()
replace all matching characters in the string
Swift String reversed()
reverses the given string
Swift String split()
breaks up a string at the specified separator
Swift String trimmingCharacters()
removes whitespace from both ends of a string
Swift String contains()
Checks if specified string is present in a string
Swift String dropFirst()
removes the first character of the string
Swift String dropLast()
removes the last character of the string
Swift String joined()
return string with elements separated by separator
Swift String lowercased()
converts all characters in the string to lowercase
Swift String removeAll()
removes elements from string based on condition
Swift String uppercased()
converts all characters in the string to uppercase