0

This:

val checkValue = udf { (array: WrappedArray[String], value: String) => array.contains(value) }

works if you do not worry about case of words.

I can apply .toLowerCase() to value easily enough to get this ...(value.toLowerCase() )

But how to apply to the incoming array being WrappedArray and not externally?

thebluephantom
  • 16,458
  • 8
  • 40
  • 83

1 Answers1

0
array.contains(value)

is the same as

array.exists(_ == value)

The _ == value can be replaced by an arbitrary predicate.

In your case, it would be something like

array.exists(value.equalsIgnoreCase)

Also, note that "ß".toUpperCase == "SS" is true, whereas "ß" == "SS".toLowerCase and "ß".compareIgnoreCase("SS") are both false, see for example this answer.

Andrey Tyukin
  • 43,673
  • 4
  • 57
  • 93