This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hello Nikesh how are you ?? | |
I hope you are doing fine. | |
Lets learn python file handling today.. CHEERS !!!!! | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyCustomView: UIView { | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
} | |
required init?(coder aDecoder: NSCoder) { | |
super.init(coder: aDecoder) | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var str = "hello Nikesh" | |
//Capitalize first letter of every word | |
var capitalizedStr = str.capitalized // "Hello Nikesh" | |
//Change string to uppercase | |
str.uppercased() // "HELLO NIKESH" | |
//change string to lowercase | |
str.lowercased() // "hello nikesh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let quotation = "Hello World" | |
var sameQuotation = "Hello World" | |
if quotation == sameQuotation { | |
print("These two strings are considered equal") | |
} | |
// Prints "These two strings are considered equal" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var someString = "Hello there" | |
//Create a string using array of characters | |
let charArray: [Character] = ["N","I","K","E", "S", "H"] | |
let srtingFromArray = String(charArray) // "NIKESH" | |
//Get array of characters from a string | |
var charatctesFromString = Array(someString) // ["H", "e", "l", "l", "o", " ", "t", "h", "e", "r", "e"] | |
print(charatctesFromString) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var firstString = "Hello Everyone." | |
var secondString = "This is Nikesh's Blog" | |
var newString = firstString + secondString | |
print(newString) | |
//OUTPUT: Hello Everyone.This is Nikesh's Blog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let constantString = "This is a single line string" | |
//now a multiline string | |
let quotation = """ | |
The White Rabbit put on his spectacles. "Where shall I begin, | |
please your Majesty?" he asked. | |
"Begin at the beginning," the King said gravely, "and go on | |
till you come to the end; then stop." | |
""" |