Code snippet showing how to use Hex Values in Swift Language to set UIColor Working code can also be found GitHub Knitesh func UIColorFromHex(rgbValue:UInt32, alpha:Double=1.0)->UIColor { let red = CGFloat((rgbValue & 0xFF0000) >> 16)/256.0 let green = CGFloat((rgbValue & 0xFF00) >> 8)/256.0 let blue = CGFloat(rgbValue & 0xFF)/256.0 return UIColor(red:red, green:green, blue:blue, alpha:CGFloat(alpha)) } let […]

Read More →

Code to check whether given string is a Palindrom or not function palindrome(str) { // Good luck! var revers = str.split(“”).reverse().join(“”).toLowerCase().replace(/\W/g, ”).replace(“_”,””); var actualStr =str.toLowerCase().replace(/\W/g, ”).replace(“_”,””); console.log(revers +” : “+actualStr); if(revers === actualStr) {return true;} return false; }

Read More →