How to remove a specific character from a string in Swift? Last Updated : 05 Jul, 2022 Comments Improve Suggest changes Like Article Like Report Swift language supports different types of generic collections and a string is one of them. A string is a collection of alphabets. In the Swift string, we check the removal of a character from the string. To do this task we use the remove() function. This function is used to remove a character from the string. It will return a character that was removed from the given string. Syntax: string.remove(at: i) Here string is an object of the string class. Parameters: This function accepts a parameter that is illustrated below: i: It is a specified index of the character to remove. Return Value: This function returns a character that was removed from the specified string. Example 1: Swift // Swift program to removes a character from the string import Swift // Creating an string var string = "GFG" // Position of the character to remove var i = string.index(string.startIndex, offsetBy: 1) // Removing the character var removed_String = string.remove(at: i) // Getting the string after removal of character print(string) // Getting the removed character print(removed_String) Output: GG F Example 2: Swift // Swift program to removes a character from the string import Swift // Creating an string var string = "Geeks" print("Before Removing:", string) // Position of the character to remove var i = string.index(string.startIndex, offsetBy: 4) // Removing the character var removed_String = string.remove(at: i) print("After Removing:", string) print("Removed Character:", removed_String) Output: Before Removing: Geeks After Removing: Geek Removed Character: s Create Quiz Comment N nidhi1352singh Follow 0 Improve N nidhi1352singh Follow 0 Improve Article Tags : How To Swift Swift-Functions Explore Swift IntroductionSwift - Hello World Program2 min readSwift - Basic Syntax5 min readSwift - Keywords4 min readSwift - Literals10 min readSwift - Constants, Variables & Print function2 min readSwift - Operators8 min readSwift Data TypesSwift - Data Types5 min readSwift - Integer, Floating-Point Numbers2 min readStrings in Swift8 min readString Functions and Operators in Swift10 min readHow to Concatenate Strings in Swift?3 min readHow to Append a String to Another String in Swift?2 min readHow to Insert a Character in String at Specific Index in Swift?2 min readHow to check if a string contains another string in Swift?2 min readHow to remove a specific character from a string in Swift?2 min readData Type Conversions in Swift5 min readSwift - Convert String to Int Swift3 min readSwift Control FlowSwift - Decision Making Statements5 min readSwift - If Statement3 min readSwift - If-else Statement3 min readSwift - If-else-if Statement3 min readSwift - Nested if-else Statement4 min readSwift - Switch Statement10 min readSwift - Loops5 min readSwift - While Loop2 min readSwift - Repeat While loop3 min readSwift - For-in Loop6 min readSwift - Control Statements in Loops5 min readSwift - Break Statement6 min readSwift - Fallthrough Statement4 min readSwift - Guard Statement15 min readSwift FunctionsCalling Functions in Swift6 min readSwift Function Parameters and Return Values10 min readHow to Use Variadic Parameters in Swift?6 min readSwift - In Out Parameters4 min readSwift - Nested Function5 min readSwift - Function Overloading8 min readClosures in Swift9 min readEscaping and Non-Escaping Closures in Swift5 min readHigher-Order Functions in Swift10 min readSwift CollectionsSwift - Arrays9 min readSwift - Arrays Properties4 min readSwift - How to Store Values in Arrays?4 min readHow to Remove the last element from an Array in Swift?4 min readHow to Remove the First element from an Array in Swift?4 min readHow to count the elements of an Array in Swift?2 min readHow to Reverse an Array in Swift?3 min readSwift Array joined() function3 min readHow to check if the array contains a given element in Swift?3 min readSorting an Array in Swift5 min readHow to Swap Array items in Swift?2 min readHow to check if an array is empty in Swift?2 min readSwift - Sets15+ min readSwift - Set Operations9 min readHow to remove first element from the Set in Swift?2 min readHow to remove all the elements from the Set in Swift?2 min readHow to check if the set contains a given element in Swift?3 min readHow to count the elements of a Set in Swift?2 min readSorting a Set in Swift4 min readHow to check if a set is empty in Swift?2 min readHow to shuffle the elements of a set in Swift?2 min readSwift - Difference Between Sets and Arrays3 min readSwift - Dictionary9 min readSwift - Tuples3 min readSwift - Iterate Arrays and Dictionaries6 min readSwift OOPsSwift Structures7 min readSwift - Properties and its Different Types13 min readSwift - Methods5 min readSwift - Difference Between Function and Method4 min readSwift - Deinitialization and How its Works?4 min readTypecasting in Swift7 min readRepeating Timers in Swift4 min readNon Repeating Timers in Swift7 min readDifference between Repeating and Non-Repeating timers in Swift4 min readOptional Chaining in Swift9 min readSingleton Class in Swift4 min readSwift Additional TopicsSwift - Error Handling2 min readDifference between Try, Try?, and Try! in Swift4 min readSwift - Typealias7 min readImportant Points to Know About Java and Swift3 min readDifference between Swift Structures and C Structure4 min readHow to Build and Publish SCADE Apps to Apple and Google Stores?11 min read6 Best iOS Project Ideas For Beginners8 min read Like