August Karlstrom
August Karlstrom

Reputation: 11377

Split string assignment

In a Play template file I would like to split a string and assign each part to a variable. However, the following does not work:

@for(x <- a) {
   @defining(x.split("""\.""")) { Array(x1, x2) =>
      ...
   }
}

Any ideas?

Upvotes: 0

Views: 471

Answers (1)

pedrofurla
pedrofurla

Reputation: 12783

You forgot the case keyword.

@for(x <- a) {
   @defining(x.split("""\.""")) { case Array(x1, x2) =>
      ...
   }
}

Upvotes: 1

Related Questions