user3179929
user3179929

Reputation: 41

In Play Scala, how enumerate a Option[List[String]] of Play's i18n LANG

please help. re: ...an Option[List[String]] that contains a list of Play's I18n lang codes, , e.g. ['es', 'en']......

I have no idea how to parse the Option[List[String]]...

Once in the format of a Option[List[String]], how do i write scala code to say, given a language code of 'es', how do I see if the Option[List[String]] contains 'es'?

Upvotes: 0

Views: 53

Answers (1)

Pim Verkerk
Pim Verkerk

Reputation: 1066

You can get rid of the Option by using getOrElse. Then you can call containson the List.

optListString.getOrElse(List.empty).contains("es")

Upvotes: 2

Related Questions