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
func moneyPlaceHolder(money: Int) -> String { | |
guard money >= 0 else { return "" } | |
let moneyString = String(money) | |
let moneyCount = moneyString.count | |
let insertPlaceCount = 3 | |
if moneyCount <= insertPlaceCount { | |
return moneyString | |
} |
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
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
class MyViewController : UIViewController { | |
var data = [ | |
"AB", | |
"BC", | |
"CD", |
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
import Foundation | |
let stringWithMathematicalOperation: String = "(34+2)/3*12-39" | |
let exp: NSExpression = NSExpression(format: stringWithMathematicalOperation) | |
let result: Double = exp.expressionValue(with:nil, context: nil) as! Double |
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
@objc func touchUpStartButtonAction() { | |
print("start") | |
for url in imageUrls { | |
DispatchQueue.global(qos: .userInteractive).async { | |
let image = UIImage(contentsOfFile: url!.relativePath) | |
DispatchQueue.main.async { | |
print(url!.relativePath) | |
self.loadingView!.imageView.image = image | |
self.loadingView!.setNeedsDisplay() |
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
@objc func touchUpStartButtonAction() { | |
print("start") | |
for url in imageUrls { | |
let image = UIImage(contentsOfFile: url!.relativePath) | |
DispatchQueue.main.async { | |
print(url!.relativePath) | |
self.loadingView!.imageView.image = image |
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
@objc func touchUpStartButtonAction() { | |
print("start") | |
for url in imageUrls { | |
let image = UIImage(contentsOfFile: url!.relativePath) | |
print(url!.relativePath) | |
self.loadingView!.imageView.image = image | |
self.loadingView!.setNeedsDisplay() | |
var t = 0 | |
for i in 0 ... 5000000 { |
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 ViewController: UIViewController { | |
var loadings = UIView() | |
var loadingView:LoadingView? | |
var imageUrls:[URL?] = [] | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
loadingsSetting() | |
startButtonSetting() |
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 text = "가나다라마바사아자차" | |
let index0 = text.startIndex | |
let indexE = text.endIndex | |
let result = text[index0 ..< indexE] | |
print(result) // "가나다라마바사아자차" |
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
if let range0 = text.range(of: "다라") { | |
let startWord = text[range0].startIndex | |
let endWord = text[range0].endIndex | |
let w0 = text[text.startIndex ..< startWord] | |
let w1 = text[startWord ..< endWord] | |
let w2 = text[endWord ..< text.endIndex] | |
print("\(w0)\n\(w1)\n\(w2)") | |
} |
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 text = "가나다라마바사아자차" | |
func stringParsing(text:String) -> (String,String,String)? { | |
let index0 = text.startIndex | |
let indexE = text.endIndex | |
let result = text[index0 ..< indexE] | |
print(result) | |
guard text.contains("다라") else { return nil } |