What is a current/idiomatic way to do the followin...
# android
t
What is a current/idiomatic way to do the following:
Copy code
listOf("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat")
I tried to use
Copy code
DateFormatSymbols().shortWeekdays()
but that surprisingly returns an array of 8 values (so that Sunday can be accessed at 1 apparently). I could slice from 1..7, but that seems hacky. Is there a current idiomatic way to get a list of short weekday names?
c
I'd use:
Copy code
DayOfWeek.values().map { it.getDisplayName(TextStyle.SHORT, Locale.getDefault()) }
🙏 2