<commit_before>//
//  String+Extension.swift
//  Pods
//
//  Created by <NAME> on 6/7/16.
//
//

// extension String: AnyType, DatabaseRepresentable {
//     //MARK: - AnyType
//     public var rawType: String { return "String" }
    
//     //MARK: - DatabaseRepresentable
//     public var dbValue: AnyType { return "'\(self)'" }
// }


public extension String {
    var untrim: String {
        var untrimmed = ""
        if !self.hasPrefix(" ") {
            untrimmed = " " + self
        }
        if !self.hasSuffix(" ") {
            untrimmed = self + " "
        }
        return untrimmed
    }
    
    public func wrap(char: String) -> String {
        return char + self + char
    }
    
    public var embrace: String {
        return "(" + self + ")"
    }
}<commit_msg>Add extra utils<commit_after>//
//  String+Extension.swift
//  Pods
//
//  Created by <NAME> on 6/7/16.
//
//

// extension String: AnyType, DatabaseRepresentable {
//     //MARK: - AnyType
//     public var rawType: String { return "String" }

//     //MARK: - DatabaseRepresentable
//     public var dbValue: AnyType { return "'\(self)'" }
// }

public extension String {
    var untrim: String {
        var untrimmed = ""
        if !self.hasPrefix(" ") {
            untrimmed = " " + self
        }
        if !self.hasSuffix(" ") {
            untrimmed = self + " "
        }
        return untrimmed
    }
    
    public func wrap(char: String) -> String {
        return char + self + char
    }
    
    public var embrace: String {
        return "(" + self + ")"
    }
}

public extension String {
    var camelString: String {
        return self.characters.split("_").map({ return String($0).capitalizedString }).joinWithSeparator("").lowercaseFirst
    }
    
    var sneakyString: String {
        let regex = try? NSRegularExpression(pattern: "([a-z])([A-Z])", options: NSRegularExpressionOptions.AllowCommentsAndWhitespace)
        let value = regex?.stringByReplacingMatchesInString(self, options: .ReportCompletion, range: NSRange(location: 0, length: self.characters.count), withTemplate: "$1_$2")
        if let result = value where result.isEmpty == false {
            return result.lowercaseString
        }
        return self
    }
    
    var first: String { return String(characters.prefix(1)) }
    var last: String { return String(characters.suffix(1)) }
    
    var uppercaseFirst: String { return first.uppercaseString + String(characters.dropFirst()) }
    var lowercaseFirst: String { return first.lowercaseString + String(characters.dropFirst()) }
}

public extension String {
    var quoted: String {
        var result = ""
        if self.hasPrefix("'") == false {
            result += "'"
        }
        result += self
        if self.hasSuffix("'") == false {
            result += "'"
        }
        return result
    }
}
{'fraction_non_alphanumeric': 0.13456833275078645, 'fraction_numerical': 0.004893393918210416, 'mean_word_length': 2.034994697773065, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5320069', 'n_tokens_mistral': 862, 'n_tokens_neox': 844, 'n_words': 210}