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
//formatterを使って日付を作成 | |
var formatter = NSNumberFormatter() | |
formatter.numberStyle = NSNumberFormatterStyle.DecimalStyle | |
formatter.groupingSeparator = "," | |
formatter.groupingSize = 3 | |
func addComma(str:String) -> String{ | |
if(str != "") { |
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 UIKit | |
class ViewController: UIViewController,UITableViewDelegate, UITableViewDataSource{ | |
@IBOutlet weak var tableView: UITableView! | |
var todoList = [String]() | |
override func viewDidLoad() { | |
super.viewDidLoad() |
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
Timer.scheduledTimer(withTimeInterval: 1, repeats: true, block:{ (_) in | |
print("po") | |
}) |
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 | |
if let path: String = Bundle.main.path(forResource: "text", ofType: "txt") { | |
do { | |
// ファイルの内容を取得する | |
let content = try String(contentsOfFile: path) | |
print("content: \(content)") | |
} catch { |
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 UIKit | |
class ViewController: UIViewController { | |
let fruits = ["リンゴ", "みかん", "ぶどう"] | |
var myTableView: UITableView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// TableViewの生成(Status barの高さをずらして表示). |
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 | |
func printMonth(first fday:Int, days:Int){ | |
var d = 1 - fday | |
func daystr()->String{ | |
if d <= 0{ | |
return " " | |
}else{ | |
return (d < 10 ? " \(d)" : " \(d)") | |
} |
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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
</head> | |
<body> | |
<div id="timer">00:00.000</div> | |
<div class="contorol"> | |
<button id = "min">Min</button> |
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
<!doctype html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Document</title> | |
<style> | |
#img{ | |
position: absolute; |
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 selectionSort(_ array:[Int])->[Int]{ | |
guard array.count > 1 else { | |
return array} | |
var a = array | |
for x in 0..<a.count - 1{ | |
var lower = x | |
for y in x + 1..<a.count{ | |
if a[y] < a[lower]{ | |
lower = y |
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 変数:型 = 式 //変数を定義するには 'var'という言葉のあとに続けて変数名を記述 | |
var age:Int = 16 //型の宣言、初期値の記述 | |
//var age = 16 型、式は省略可能 | |
age = 20 //varで宣言した場合は数値の変更可能 |
OlderNewer