#!/usr/bin/env swift; /****************************************************************************** * This program formats characters and strings. * * Copyright © 2020 Richard Lesh. All rights reserved. *****************************************************************************/ import Foundation import Utils let c1:Character = "C" let c2:String = "-" let c3:Int = 51 let c4:Int = 80 let c5:Int = 0x4F let s:String = "Boba Fett" func main() -> Void { print(Utils.format("c1: {0:c}", c1)) print(Utils.format("c2: {0:c}", c2)) print(Utils.format("c3: {0:c}", c3)) print(Utils.format("c4: {0:c}", c4)) print(Utils.format("c5: {0:c}", c5)) print(Utils.format("s: {0:s}", s)) print(Utils.format("s: {0:.4s}", s)) print(Utils.format("s: |{0:10.4s}|", s)) print(Utils.format("s: |{0:>10.4s}|", s)) print(Utils.format("s: |{0:^10.4s}|", s)) exit(EXIT_SUCCESS) } main()