<commit_before># Emarcam
## Getting started
Assuming you have integrated `Emarcam` into your project using your preferred method (CococaPods, Carthage, Swift Package Manager or manually), just import the module at the top of your file.

````swift
import Emarcam
````

## Subscripting
`Emarcam` greatly simplifies subscripting strings by allowing you to use `Int`s as indices. For example:
````swift
let str = "Hello, playground!"
str[0] // "H"
str[1] // "e"
str[0..<4] // "Hell"
str[0...4] // "Hello"
str[6..<str.count] // " playground!"
````
Compare this to the same expressions in Swift 4.
````swift
str[str.startIndex]
str[str.index(after: str.startIndex)]
str[str.startIndex..<str.index(str.startIndex, offsetBy:4)]
str[str.startIndex...str.index(str.startIndex, offsetBy:4)]
str[str.index(str.startIndex, offsetBy:6)..<str.endIndex]
````
## Replacing Substrings
The same simplified integer ranges can be used in the replacement methods. Here the Kanji '休' is replaced with its pronunciation 'やす'.
````swift
var ms0 = "お休みなさい"
let hiragana: [Character] = [ "や", "す" ]
ms0.replaceSubrange(1..<2, with: hiragana)
// おやすみなさい
````
## Removing Substrings
Removal of substrings is also a happier experience.
````swift
var ms1 = "😭☠️☠️😀💀😀☠️☠️😡"
ms1.removeSubrange(0...2)          // ms1 = "😀💀😀☠️☠️😡"
ms1.remove(at: 1)                  // returns '💀' and ms1 = "😀😀☠️☠️😡"
ms1.removeSubrange(2..<ms1.count)  // ms1 = ""😀😀"
````<commit_msg>[Docs] Added backported methods to README.<commit_after># Emarcam
## Getting started
Assuming you have integrated `Emarcam` into your project using your preferred method (CococaPods, Carthage, Swift Package Manager or manually), just import the module at the top of your file.

````swift
import Emarcam
````

## Subscripting
`Emarcam` greatly simplifies subscripting strings by allowing you to use `Int`s as indices. For example:
````swift
let str = "Hello, playground!"
str[0] // "H"
str[1] // "e"
str[0..<4] // "Hell"
str[0...4] // "Hello"
str[6..<str.count] // " playground!"
````
Compare this to the same expressions in Swift 4.
````swift
str[str.startIndex]
str[str.index(after: str.startIndex)]
str[str.startIndex..<str.index(str.startIndex, offsetBy:4)]
str[str.startIndex...str.index(str.startIndex, offsetBy:4)]
str[str.index(str.startIndex, offsetBy:6)..<str.endIndex]
````
## Replacing Substrings
The same simplified integer ranges can be used in the replacement methods. Here the Kanji '休' is replaced with its pronunciation 'やす'.
````swift
var ms0 = "お休みなさい"
let hiragana: [Character] = [ "や", "す" ]
ms0.replaceSubrange(1..<2, with: hiragana)
// おやすみなさい
````
## Removing Substrings
Removal of substrings is also a happier experience.
````swift
var ms1 = "😭☠️☠️😀💀😀☠️☠️😡"
ms1.removeSubrange(0...2)          // ms1 = "😀💀😀☠️☠️😡"
ms1.remove(at: 1)                  // returns '💀' and ms1 = "😀😀☠️☠️😡"
ms1.removeSubrange(2..<ms1.count)  // ms1 = ""😀😀"
````

## Methods Backported to Swift 3
Emarcam backports some Swift 4 goodness into Swift 3.
### Drop
```swift
// MARK: - Non-mutating Removal (Backported)
public func dropFirst() -> SubstringType
public func dropFirst(_ n: Int) -> SubstringType
public func dropLast() -> SubstringType
public func dropLast(_ n: Int) -> SubstringType
```
### Remove
```swift
// MARK: - Mutating Removal (Backported)
mutating func removeFirst() -> Character
mutating func removeFirst(_ n: Int)
mutating func removeLast(_ n: Int)
mutating func removeLast() -> Character
```
{'fraction_non_alphanumeric': 0.17039187227866473, 'fraction_numerical': 0.016545718432510886, 'mean_word_length': 4.392801251956182, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 9, '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': '843192', 'n_tokens_mistral': 1262, 'n_tokens_neox': 1294, 'n_words': 369}