Add Name.last extension

This commit is contained in:
Alexander Nozik 2023-10-29 10:48:33 +03:00
parent 706521a6b6
commit e52d509c2b

View File

@ -134,6 +134,11 @@ public val Name.length: Int get() = tokens.size
*/ */
public fun Name.lastOrNull(): NameToken? = tokens.lastOrNull() public fun Name.lastOrNull(): NameToken? = tokens.lastOrNull()
/**
* Last token or throw exception
*/
public fun Name.last(): NameToken = tokens.last()
/** /**
* First token of the name or null if it is empty * First token of the name or null if it is empty
*/ */