<commit_before>//
//  UIColor+HexColors.swift
//  Luna
//
//  Created by <NAME> on 12/11/14.
//  Copyright (c) 2014 <NAME>. All rights reserved.
//

// http://stackoverflow.com/a/27203691

import UIKit

extension UIColor {
    
    class func hexColor(string: String) -> UIColor {
        let set = NSCharacterSet.whitespacesAndNewlines() as NSCharacterSet
        var colorString = string.trimmingCharacters(in: set).uppercased()
        
//        if (colorString.hasPrefix("#")) {
//            
//            let someting = colorString.startIndex
//            
//            let index = colorString.startIndex.sub
//            colorString = colorString.substring(from: 1)
//        }
        
        if (colorString.characters.count != 6) {
            return UIColor.gray()
        }
        
        var rgbValue: UInt32 = 0
        NSScanner(string: colorString).scanHexInt32(&rgbValue)
        
        return UIColor(
            red:   CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0,
            green: CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0,
            blue:  CGFloat(rgbValue & 0x0000FF) / 255.0,
            alpha: CGFloat(1.0)
        )
    }
}<commit_msg>Grab index for second position<commit_after>//
//  UIColor+HexColors.swift
//  Luna
//
//  Created by <NAME> on 12/11/14.
//  Copyright (c) 2014 <NAME>. All rights reserved.
//

// http://stackoverflow.com/a/27203691

import UIKit

extension UIColor {
    
    class func hexColor(string: String) -> UIColor {
        let set = NSCharacterSet.whitespacesAndNewlines() as NSCharacterSet
        var colorString = string.trimmingCharacters(in: set).uppercased()
        
        if (colorString.hasPrefix("#")) {
            let index = colorString.index(after: colorString.startIndex)
            colorString = colorString[index..<colorString.endIndex]
        }
        
        if (colorString.characters.count != 6) {
            return UIColor.gray()
        }
        
        var rgbValue: UInt32 = 0
        NSScanner(string: colorString).scanHexInt32(&rgbValue)
        
        return UIColor(
            red:   CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0,
            green: CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0,
            blue:  CGFloat(rgbValue & 0x0000FF) / 255.0,
            alpha: CGFloat(1.0)
        )
    }
}
{'fraction_non_alphanumeric': 0.12316335350043216, 'fraction_numerical': 0.04883318928262748, 'mean_word_length': 1.8793532338308458, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2460684', 'n_tokens_mistral': 812, 'n_tokens_neox': 737, 'n_words': 149}