Stdlib: moved CharSequence.size and String.size to StringJVM.kt because they are intrinsic in JS.
This commit is contained in:
@@ -41,15 +41,6 @@ public fun CharSequence.iterator(): CharIterator = object : CharIterator() {
|
||||
/** Returns the string if it is not null or the empty string if its null */
|
||||
public fun String?.orEmpty(): String = this ?: ""
|
||||
|
||||
|
||||
// "Extension functions" for CharSequence
|
||||
|
||||
public val CharSequence.size: Int
|
||||
get() = this.length
|
||||
|
||||
public val String.size: Int
|
||||
get() = length()
|
||||
|
||||
public val String.indices: IntRange
|
||||
get() = 0..length() - 1
|
||||
|
||||
|
||||
@@ -136,6 +136,12 @@ public fun CharSequence.toString(): String? = (this as java.lang.CharSequence).t
|
||||
|
||||
public fun CharSequence.length(): Int = (this as java.lang.CharSequence).length()
|
||||
|
||||
public val CharSequence.size: Int
|
||||
get() = this.length
|
||||
|
||||
public val String.size: Int
|
||||
get() = 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)
|
||||
|
||||
Reference in New Issue
Block a user