在科特林源代碼的源代碼實現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。 –