Substitute values in a string with placeholders in Scala

后端 未结 5 374
日久生厌
日久生厌 2020-12-24 03:33

I have just started using Scala and wish to better understand the functional approach to problem solving. I have pairs of strings the first has placeholders for parameter an

5条回答
  •  自闭症患者
    2020-12-24 03:45

    This is not a direct answer to your question but more of a Scala trick. You can interpolate strings in Scala by using xml:

    val id = 250
    val value = "some%"
    select col1 from tab1 where id > {id} and name like {value}.text
    // res1: String = select col1 from tab1 where id > 250 and name like some%
    

    Eric.

提交回复
热议问题