Tag: string
-
Data types in Swift
Swift provides us with both built-in and user defined data types. The most common data types available with Swift are as follows: Integer Float Double Boolean Optional Tuple Character String
-
How to append a character to a string in Swift?
We can append a character to the string using append().
-
String mutability in Swift
We can allow a string to be modified (mutated) or not by assigning it to constant(let) (doesn’t allow modification) or variable (var)(allows modification) in Swift. In case of objective-c and cocoa, we have to assign the string to separate classes such NSmutableString, NSString.
-
How to include Unicode scalar values in String literals?
We can include unicode scalar values in string literal by using the format \u{n}. n varies from 1-8 digit hexadecimal numbers.
-
How to include special characters in String literals?
We can include the following special characters in String literals. \0 (null character) \” (double quotation) \’ (single quotation) \t (horizontal tab) \r (carriage return) \n (linefeed) \\ (backlash)
-
JavaScript: String.replace()
The string replace method searches a string for a specified value and replaces it with a provided data. A new replace string will be returned.
-
Swift: How to add extra zeroes to binary numbers?
We have to manually code to add extra zeroes to the binary number to make them as 8 digits.