Skip to content

Instantly share code, notes, and snippets.

View nikeshkrjha's full-sized avatar
💭
Feeling Aswesome :)

Nikesh Jha nikeshkrjha

💭
Feeling Aswesome :)
View GitHub Profile
Hello Nikesh how are you ??
I hope you are doing fine.
Lets learn python file handling today.. CHEERS !!!!!
@nikeshkrjha
nikeshkrjha / CustomView.swift
Created August 11, 2017 07:32
Custom UIViews in swift
class MyCustomView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
@nikeshkrjha
nikeshkrjha / CaseConversionSnippet.swift
Last active August 11, 2017 06:55
Case Conversion in swift
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"
@nikeshkrjha
nikeshkrjha / StringsComparison.swift
Last active August 11, 2017 06:41
Strings Comparison
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"
@nikeshkrjha
nikeshkrjha / StringsCharactersDemo.swift
Last active August 11, 2017 07:15
Working with characters in Strings
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)
@nikeshkrjha
nikeshkrjha / StringConcatenation.swift
Created August 10, 2017 20:13
Strings concatenation in swift
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
@nikeshkrjha
nikeshkrjha / StringsManipulationDemo.swift
Last active August 10, 2017 20:10
Strings manipulation in swift (Compatible with swift 4)
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."
"""