From 009baa11fcba4d432ac30a6ee8a51236f6c02dd0 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Thu, 4 Jun 2015 16:45:55 +0300 Subject: [PATCH] Specific wording in exception message for String methods. --- libraries/stdlib/src/generated/_Filtering.kt | 6 +++--- .../tools/kotlin-stdlib-gen/src/templates/Filtering.kt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/stdlib/src/generated/_Filtering.kt b/libraries/stdlib/src/generated/_Filtering.kt index 904825f0b85..0f12cbb6c21 100644 --- a/libraries/stdlib/src/generated/_Filtering.kt +++ b/libraries/stdlib/src/generated/_Filtering.kt @@ -292,7 +292,7 @@ public fun List.dropLast(n: Int): List { * Returns a string with the last [n] characters removed. */ public fun String.dropLast(n: Int): String { - require(n >= 0, { "Requested element count $n is less than zero." }) + require(n >= 0, { "Requested character count $n is less than zero." }) return take((length() - n).coerceAtLeast(0)) } @@ -1384,7 +1384,7 @@ public fun Stream.take(n: Int): Stream { * Returns a string containing the first [n] characters from this string, or the entire string if this string is shorter. */ public fun String.take(n: Int): String { - require(n >= 0, { "Requested element count $n is less than zero." }) + require(n >= 0, { "Requested character count $n is less than zero." }) return substring(0, Math.min(n, length())) } @@ -1532,7 +1532,7 @@ public fun List.takeLast(n: Int): List { * Returns a string containing the last [n] characters from this string, or the entire string if this string is shorter. */ public fun String.takeLast(n: Int): String { - require(n >= 0, { "Requested element count $n is less than zero." }) + require(n >= 0, { "Requested character count $n is less than zero." }) val length = length() return substring(length - Math.min(n, length), length) } diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Filtering.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Filtering.kt index 8f1b5b12778..11deb429ee9 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Filtering.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Filtering.kt @@ -91,7 +91,7 @@ fun filtering(): List { doc(Strings) { "Returns a string containing the first [n] characters from this string, or the entire string if this string is shorter."} body(Strings) { """ - require(n >= 0, { "Requested element count $n is less than zero." }) + require(n >= 0, { "Requested character count $n is less than zero." }) return substring(0, Math.min(n, length())) """ } @@ -140,7 +140,7 @@ fun filtering(): List { returns("String", Strings) body(Strings) { """ - require(n >= 0, { "Requested element count $n is less than zero." }) + require(n >= 0, { "Requested character count $n is less than zero." }) return take((length() - n).coerceAtLeast(0)) """ } @@ -155,7 +155,7 @@ fun filtering(): List { doc(Strings) { "Returns a string containing the last [n] characters from this string, or the entire string if this string is shorter."} body(Strings) { """ - require(n >= 0, { "Requested element count $n is less than zero." }) + require(n >= 0, { "Requested character count $n is less than zero." }) val length = length() return substring(length - Math.min(n, length), length) """