Skip to content

Instantly share code, notes, and snippets.

@AAlfare
Created October 11, 2018 07:30
Show Gist options
  • Select an option

  • Save AAlfare/348c954bd3bcd9c6e42be04cb49b856c to your computer and use it in GitHub Desktop.

Select an option

Save AAlfare/348c954bd3bcd9c6e42be04cb49b856c to your computer and use it in GitHub Desktop.
String + various spaces
extension String {
// NARROW NO-BREAK SPACE
// Unicode: U+202F, UTF-8: E2 80 AF
static let narrowNoBreakSpace = "\u{202F}"
//MEDIUM MATHEMATICAL SPACE
//Unicode: U+205F, UTF-8: E2 81 9F
static let mediumMathematicalSpace = "\u{205F}"
//HAIR SPACE
//Unicode: U+200A, UTF-8: E2 80 8A
static let hairSpace = "\u{200A}"
//THIN SPACE
//Unicode: U+2009, UTF-8: E2 80 89
static let thinSpace = "\u{2009}"
//PUNCTUATION SPACE
//Unicode: U+2008, UTF-8: E2 80 88
static let punctuationSpace = "\u{2008}"
//FIGURE SPACE
//Unicode: U+2007, UTF-8: E2 80 87
static let figureSpace = "\u{2007}"
//
//NO-BREAK SPACE
//Unicode: U+00A0, UTF-8: C2 A0
static let noBreakSpace = "\u{00A0}"
//EN SPACE
//Unicode: U+2002, UTF-8: E2 80 82
static let enSpace = "\u{2002}"
//EM SPACE
//Unicode: U+2003, UTF-8: E2 80 83
static let emSpace = "\u{2003}"
//THREE-PER-EM SPACE
//Unicode: U+2004, UTF-8: E2 80 84
static let threePerEmSpace = "\u{2004}"
//FOUR-PER-EM SPACE
//Unicode: U+2005, UTF-8: E2 80 85
static let fourPerEmSpace = "\u{2005}"
//SIX-PER-EM SPACE
//Unicode: U+2006, UTF-8: E2 80 86
static let sixPerEmSpace = "\u{2006}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment