Groovy - How to compare the string?

后端 未结 7 1648
醉话见心
醉话见心 2021-02-04 23:03

how to compare the string which is passed as a parameter

the following method is not working.

 String str = \"saveMe\"

 compareString(str)

 def         


        
相关标签:
7条回答
  • 2021-02-04 23:49

    This line:

    if(str2==${str}){
    

    Should be:

    if( str2 == str ) {
    

    The ${ and } will give you a parse error, as they should only be used inside Groovy Strings for templating

    0 讨论(0)
提交回复
热议问题