且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Java检查字符串是否是回文的方法

更新时间:2022-11-01 10:20:15

您可以尝试以下方法:

    String variable = ""; #write a string name

    StringBuffer rev = new StringBuffer(variable).reverse(); 

    String strRev = rev.toString(); 

    if(variable.equalsIgnoreCase(strRev)) # Check the condition