String length: Difference between revisions

m
→‎{{header|Kotlin}}: made the kotlin example not use java
(Add Plain English)
m (→‎{{header|Kotlin}}: made the kotlin example not use java)
Line 1,851:
 
As each UTF-16 character occupies 2 bytes, it follows that the number of bytes occupied by the string will be twice the length:
<syntaxhighlight lang="scalakotlin">// version 1.0.6
fun main(args: Array<String>) {
val s = "José"
println("The char length is ${s.length}")
println("The byte length is ${CharacterChar.BYTESSIZE_BYTES * s.length}")
}</syntaxhighlight>
 
32

edits