Deprecate size and length property on CharSequence.

This commit is contained in:
Ilya Ryzhenkov
2014-12-15 17:16:53 +03:00
parent 053586f481
commit f7d4ca092c
4 changed files with 9 additions and 6 deletions
@@ -175,3 +175,8 @@ public val Map<*, *>.empty: Boolean
deprecated("Use isNotEmpty() function call instead")
public val Collection<*>.notEmpty: Boolean
get() = isNotEmpty()
deprecated("Use length() instead")
public val CharSequence.length: Int
get() = length()
@@ -42,3 +42,7 @@ deprecated("Use length() instead")
public val String.size: Int
get() = length()
deprecated("Use length() instead")
public val CharSequence.size: Int
get() = length()
@@ -64,9 +64,6 @@ public fun String?.orEmpty(): String = this ?: ""
public val String.indices: IntRange
get() = 0..length() - 1
public val CharSequence.length: Int
get() = length()
public fun CharSequence.get(index: Int): Char = this.charAt(index)
/**
@@ -119,9 +119,6 @@ public fun String.toLowerCase(locale: java.util.Locale): String = (this as java.
public fun String.toUpperCase(locale: java.util.Locale): String = (this as java.lang.String).toUpperCase(locale)
public val CharSequence.size: Int
get() = this.length
public fun String.toBoolean(): Boolean = java.lang.Boolean.parseBoolean(this)
public fun String.toShort(): Short = java.lang.Short.parseShort(this)
public fun String.toInt(): Int = java.lang.Integer.parseInt(this)