Replace Regex.match and matchAll usages

This commit is contained in:
Ilya Gorbunov
2015-11-07 15:30:44 +03:00
parent f06d521bfe
commit 0579f6c8bf
4 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -110,7 +110,7 @@ public class Regex(pattern: String, options: Set<RegexOption>) {
* replacement for that match.
*/
public inline fun replace(input: CharSequence, transform: (MatchResult) -> CharSequence): String {
var match = match(input)
var match = find(input)
if (match == null) return input.toString()
var lastStart = 0
@@ -148,7 +148,7 @@ public class Regex(pattern: String, options: Set<RegexOption>) {
*/
public fun split(input: CharSequence, limit: Int = 0): List<String> {
require(limit >= 0, { "Limit must be non-negative, but was $limit" } )
val matches = matchAll(input).let { if (limit == 0) it else it.take(limit - 1) }
val matches = findAll(input).let { if (limit == 0) it else it.take(limit - 1) }
val result = ArrayList<String>()
var lastStart = 0