Option[String] to String?

Hi,

I’m new to Gatling and scala, and have now been struggeling for too long with following:
In a request response I want to pick up the “data-lessonstatus” string value, and make some simple char replacement before storing it as session string var “lessonStatus”
But there seems to be some type mismatch: .saveAs takes a string, but .transform gives a option[String]

.exec(http(“request_6”)
.check(regex(""“data-lessonstatus=’([A-Z,0-9,&,#,;]*)’”"")
.find.transform( s => {
s.get.replaceAll(“Ö”, “Ö”).replaceAll(“Å”, “Å”)
s
}
.saveAs(“lessonStatus”))

any hints welcome!

Hi,

.check(regex(""“data-lessonstatus=’([A-Z,0-9,&,#,;]*)’”"")
.find.transform( .map(.replaceAll(“Ö”, “Ö”).replaceAll(“Å”, “Å”) ))
.saveAs(“lessonStatus”))

Is this working ?
Do you get it?

cheers
Nicolas

wow…works perfectly! :slight_smile: also beautiful solution.