TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

<< Back to SWIFT

Swift String

Use strings and string literals. See a list of string methods that can be called.
String. A cloud of mist gathers in the forest. Now it forms the letters of a word. You glimpse this mysterious string data for just a few moments.
Split. We invoke the components() method to split a string into a string array. We must specify a delimiter (or set of char delimiters) to separate parts.SplitJoin
Length. The length of a string is returned by the endIndex property. This not an Int. Instead it is an index, so we can use it to access or change other chars in a string.endIndex: Length
Substring. With a range we address a group of characters in a string. To take a substring, we create a range (with advance, startIndex, endIndex) and then access it.Substring
Convert to Int. With toInt() we convert a string to an Int. This returns an optional Int, which we can access in an "if let" statement.Convert
Trim. In Foundation, we find a method that can trim characters from the start and end of a string. We pass a set of characters, and these are removed.Trim
Padding. In Foundation, we can apply padding (of any string) to an existing string. This adds characters to a string until a certain length is met.Padding
Reverse. No built-in method reverses a string. But with an extension method, we can call reverse() on a string to invert the ordering of the string's characters.Reverse String
Ciphers. A cipher translates the characters of a string according to some logic. For example, a Caesar cipher shifts characters, wrapping values when needed.Cipher: CaesarCipher: ROT13
ASCII table. The indexes 0 through 127 are used to represent ASCII characters. Swift provides some helpful methods (on UnicodeScalar) for handling ASCII.ASCII Table
Many features. Strings are used in complex ways. It makes sense that there are many ways to test and change them. Some familiarity makes this easier.
© TheDeveloperBlog.com
Home
The Dev Codes

Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf