{"id":359,"date":"2012-05-09T11:09:59","date_gmt":"2012-05-09T16:09:59","guid":{"rendered":"http:\/\/www.thaylin.com\/blog\/?p=359"},"modified":"2012-05-09T11:10:09","modified_gmt":"2012-05-09T16:10:09","slug":"helpful-snippet-for-me-at-the-moment","status":"publish","type":"post","link":"https:\/\/www.thaylin.com\/blog\/2012\/05\/09\/helpful-snippet-for-me-at-the-moment\/","title":{"rendered":"Helpful snippet for me at the moment"},"content":{"rendered":"<p>Here&#8217;s a handy little code snippet. Need to append the placement of a number? Use this!<\/p>\n<pre lang=\"actionscript\" line=\"1\" colla=\"+\">\r\nprivate function getNth (num:Number):String\r\n\t\t{ \r\n\t\t\tvar qn:int = ((num%100) \/ 10); \r\n\t\t\tvar rn:int = num % 10; \r\n\t\t\t\r\n\t\t\tvar suffix:String = \"th\"; \r\n\t\t\t\r\n\t\t\tif (qn != 1) { \r\n\t\t\t\tswitch (rn) { \r\n\t\t\t\t\tcase 1: suffix = \"st\"; break; \r\n\t\t\t\t\tcase 2: suffix = \"nd\"; break; \r\n\t\t\t\t\tcase 3: suffix = \"rd\"; break; \r\n\t\t\t\t} \r\n\t\t\t} \r\n\t\t\t\r\n\t\t\treturn num + suffix; \r\n\t\t} \r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a handy little code snippet. Need to append the placement of a number? Use this! private function getNth (num:Number):String { var qn:int = ((num%100) \/ 10); var rn:int = num % 10; var suffix:String = &#8220;th&#8221;; if (qn != 1) { switch (rn) { case 1: suffix = &#8220;st&#8221;; break; case 2: suffix = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[11,6,27],"tags":[],"_links":{"self":[{"href":"https:\/\/www.thaylin.com\/blog\/wp-json\/wp\/v2\/posts\/359"}],"collection":[{"href":"https:\/\/www.thaylin.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.thaylin.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.thaylin.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thaylin.com\/blog\/wp-json\/wp\/v2\/comments?post=359"}],"version-history":[{"count":5,"href":"https:\/\/www.thaylin.com\/blog\/wp-json\/wp\/v2\/posts\/359\/revisions"}],"predecessor-version":[{"id":364,"href":"https:\/\/www.thaylin.com\/blog\/wp-json\/wp\/v2\/posts\/359\/revisions\/364"}],"wp:attachment":[{"href":"https:\/\/www.thaylin.com\/blog\/wp-json\/wp\/v2\/media?parent=359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thaylin.com\/blog\/wp-json\/wp\/v2\/categories?post=359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thaylin.com\/blog\/wp-json\/wp\/v2\/tags?post=359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}