Skip to content

Instantly share code, notes, and snippets.

View jpopham's full-sized avatar

jpopham

  • Epsom,UK
View GitHub Profile
@jpopham
jpopham / gist:55ed82e095220d9a3c0b
Created February 9, 2015 02:01
Two Swift functions to better format messages that contain a number
func countMessage(count:Int,message:String,numberAsWords:Bool = false, wordForZero:String="zero",capitaliseCountWordAlways:Bool = false, capitaliseCountWordIfFirst:Bool = true, insertAnds:Bool = false)->String{
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Outputs a string which contains the correct plural form of words affected by count
// Examples:
// countMessage(105,"Here [is:are] [count] [person:people]) -> "Here are 105 people"
// countMessage(1,"Here [is:are] [count] [person:people]) -> "Here is 1 person"
// countMessage(0,"Here [is:are] [count] [person:people]) -> "Here are 0 people"
//
// Dependencies:
// Requires intToWords(..)
<style>
html, body {
height: 100%;
}
.page-wrap {
min-height: 100%;
/* equal to footer height */
margin-bottom: -142px;
}
.page-wrap:after {