' \ '-Invalid character constant?

前端 未结 7 1620
夕颜
夕颜 2020-12-19 11:27

I need to do this:

while (result2.charAt(j)!=\'\\\'){

    }

I get an error saying: Invalid character constant.

Why? a

7条回答
  •  攒了一身酷
    2020-12-19 12:10

    You need to escape it I think,

    So you need to do

    while(results2.charAt(j)!='\\')
    {
    }
    

    I think that's the solution I think

提交回复
热议问题