检查 C++/Java 中的回文
Possible Duplicate:
Check string for palindrome
Hello experts. I am asked, if it is possible to find whether a string is palidrome of another string in just one line of code in C++/Java.
If yes, then how?
Can any one answer. Thnx for ur view.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 Java 中,
String
没有reverse
方法。不过StringBuilder
有,所以您仍然可以在一行中完成:Ideone.com demo
In Java,
String
does not have areverse
method.StringBuilder
has though, so you can still do it in one line:Ideone.com demo
使用reverse 反转字符串,然后与原始字符串进行比较。
Reverse the string using reverse and then compare with original string.