<commit_before>//
//  String.swift
//  Core
//
//  Created by <NAME> on 5/7/16.
//  Copyright © 2016 Wolox. All rights reserved.
//

import Foundation

/**
    Appends two string, similar to web resource addressing.
    
    - parameter lhs: base string.
    - parameter rhs: string that will be appended.
 */
public func / (lhs: String, rhs: String) -> String {
    return (lhs as NSString).stringByAppendingPathComponent(rhs)
}

public extension String {
    
    /**
     Returns a localized representation of the string.
     
     - parameter bundle: Bundle were to search for localization.
    */
    public func localized(bundle: NSBundle = NSBundle.mainBundle()) -> String {
        return NSLocalizedString(self, tableName: nil, bundle: bundle, value: "", comment: "")
    }
    
    /**
     Returns a localized representation of the string.
     
     - parameter bundle: Bundle were to search for localization.
     - parameter arguments: Formatting arguments.
     */
    public func localized(bundle: NSBundle = NSBundle.mainBundle(), arguments: CVarArgType...) -> String {
        return String(format: NSLocalizedString(self, tableName: nil, bundle: bundle, value: "", comment: ""), arguments: arguments)
    }
    
    /**
     Returns the length of the string.
     
     - Complexity: O(1) if String's `Index` conforms to `RandomAccessIndexType`;
     O(N) otherwise.
     - note: It is a function and not a property because possible O(N) computation cost.
     - seealso: CharacterView.count
     */
    public func length() -> Int {
        return characters.count
    }
    
    /**
     Builds an NSURL from a string.
     */
    public var url: NSURL? {
        return NSURL(string: self)
    }
    
    /**
     Checks if the string has spaces or not.
     */<commit_msg>Localized with arguments use localized without arguments<commit_after>//
//  String.swift
//  Core
//
//  Created by <NAME> on 5/7/16.
//  Copyright © 2016 Wolox. All rights reserved.
//

import Foundation

/**
    Appends two string, similar to web resource addressing.
    
    - parameter lhs: base string.
    - parameter rhs: string that will be appended.
 */
public func / (lhs: String, rhs: String) -> String {
    return (lhs as NSString).stringByAppendingPathComponent(rhs)
}

public extension String {
    
    /**
     Returns a localized representation of the string.
     
     - parameter bundle: Bundle were to search for localization.
    */
    public func localized(bundle: NSBundle = NSBundle.mainBundle()) -> String {
        return NSLocalizedString(self, tableName: nil, bundle: bundle, value: "", comment: "")
    }
    
    /**
     Returns a localized representation of the string.
     
     - parameter bundle: Bundle were to search for localization.
     - parameter arguments: Formatting arguments.
     */
    public func localized(bundle: NSBundle = NSBundle.mainBundle(), arguments: CVarArgType...) -> String {
        return String(format: localized(), arguments: arguments)
    }
    
    /**
     Returns the length of the string.
     
     - Complexity: O(1) if String's `Index` conforms to `RandomAccessIndexType`;
     O(N) otherwise.
     - note: It is a function and not a property because possible O(N) computation cost.
     - seealso: CharacterView.count
     */
    public func length() -> Int {
        return characters.count
    }
    
    /**
     Builds an NSURL from a string.
     */
    public var url: NSURL? {
        return NSURL(string: self)
    }
    
    /**
     Checks if the string has spaces or not.
     */
{'fraction_non_alphanumeric': 0.10260723296888141, 'fraction_numerical': 0.005046257359125316, 'mean_word_length': 2.3755912961210974, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1199175', 'n_tokens_mistral': 1011, 'n_tokens_neox': 974, 'n_words': 352}