is following possible in kotlin? if not, what will...
# announcements
s
is following possible in kotlin? if not, what will be the kotlin way to do it
Copy code
while (isalnum(LastChar = getchar())) {
    IdentifierStr += LastChar;
}
taken from c++.
🚫 2
m
probably something similar to this? It's not equivalent but I can't see the context..
Copy code
val identifierStr = generateSequence { getChar() }
.takeWhile { isalnum(it) }
.joinToString(separator = "")
e
Copy code
val list = getChars()
val identifier = list.takeWhile { it.isAlphabet() || it.isDigit() }.joinToString()
like that? idk
s
thanks! first one sounds good.
1