Skip to content

[Kotlin] 별의별 코틀린 표준 라이브러리(Iterable, String) #9

Description

@dkdud9261

indices

val CharSequence.indices: IntRange

문자 시퀀스에 대해 유효한 문자 인덱스 range를 반환한다.

usage

val str = "hello"
println(str.indices) // 0..4

문자열의 각 문자를 인덱스로 탐색할 때 Iterable 함수랑 연계해서 사용하면 유용하다.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions