在科特林源代码的源代码实现string.kt的,我不明白如何实现String.kt的长度,它是如下:我无法理解在科特林
package kotlin
public class String : Comparable<String>, CharSequence {
companion object {}
/**
* Returns a string obtained by concatenating this string with the string representation of the given [other] object.
*/
public operator fun plus(other: Any?): String
public override val length: Int
public override fun get(index: Int): Char
public override fun subSequence(startIndex: Int, endIndex: Int): CharSequence
public override fun compareTo(other: String): Int}
var len:Int = "abc".length; // len = 3 where to run the length??
在哪里实现长度函数?
当你写这个''abc“.length'并返回你想要的长度字符串? –
是的,我可以得到正确的结果。我只想知道在哪里实施kotlin源代码。我已经添加了上面的String.kt。 –