<commit_before>//
//  StringExtensions.swift
//  SwiftUtilsTest
//
//  Created by <NAME> on 5/18/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation


//Standard library conveniences and extensions.

public extension String {
    
    
    /**
     
     Convenience property for a `String`'s length
     
     */
    public var length: Int {
        
        return self.characters.count
        
    }
    /**
     
     An Array of the individual substrings composing `self`. Read-only.
     
     */
    public var chars: [String] {
        
        return Array(self.characters).map({String($0)})
        
    }
    
    public var firstCharacter: String? {
        
        return self.chars.first
        
    }
    
    public var lastCharacter: String? {
        
        return self.chars.last
        
    }
    
    public var isEmpty: Bool {
        
        return self.chars.isEmpty
        
    }
    /**
     
     Returns the number of times `string` appears in self.
     
     */
    public func count(string: String) -> Int {
        
        return self.regex.numberOfMatchesInString(string)
    }

    /// Returns the first index where `value` appears in `self` or `nil` if
    /// `value` is not found.
    ///
    /// - Complexity: O(`self.count`).
    func indexOf(element: String) -> Int? {
        
        return self.chars.indexOf(element)
        
    }
    
    mutating func insertString(string: String, atIndex: Int) {
        
        var _copy = self.chars
        _copy.insert(string, atIndex: atIndex)
        self = _copy.joinWithSeparator("")
        
    }
    /**
     
     Function to allow range removal with Int Ranges.
     
     */
    mutating func removeRange(range: Range<Int>) {
        
        var _copy = self.chars<commit_msg>formatting<commit_after>//
//  StringExtensions.swift
//  SwiftUtilsTest
//
//  Created by <NAME> on 5/18/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation


//Standard library conveniences and extensions.

public extension String {
    
    
    /**
     
     Convenience property for a `String`'s length
     
     */
    public var length: Int {
        
        return self.characters.count
        
    }
    /**
     
     An Array of the individual substrings composing `self`. Read-only.
     
     */
    public var chars: [String] {
        
        return Array(self.characters).map({String($0)})
        
    }
    
    public var firstCharacter: String? {
        
        return self.chars.first
        
    }
    
    public var lastCharacter: String? {
        
        return self.chars.last
        
    }
    
    public var isEmpty: Bool {
        
        return self.chars.isEmpty
        
    }
    /**
     
     Returns the number of times `string` appears in self.
     
     */
    public func count(string: String) -> Int {
        
        return self.regex.numberOfMatchesInString(string)
    }

    /// Returns the first index where `value` appears in `self` or `nil` if
    /// `value` is not found.
    ///
    /// - Complexity: O(n).
    func indexOf(element: String) -> Int? {
        
        return self.chars.indexOf(element)
        
    }
    
    mutating func insertString(string: String, atIndex: Int) {
        
        var _copy = self.chars
        _copy.insert(string, atIndex: atIndex)
        self = _copy.joinWithSeparator("")
        
    }
    /**
     
     Function to allow range removal with Int Ranges.
     
     */
    mutating func removeRange(range: Range<Int>) {
        
        var _copy = self.chars
{'fraction_non_alphanumeric': 0.10033351862145637, 'fraction_numerical': 0.005558643690939411, 'mean_word_length': 1.530942334739803, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, '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': '2638390', 'n_tokens_mistral': 1059, 'n_tokens_neox': 1030, 'n_words': 277}