进行检查(字符串结尾) [英] Make a check(string endings)
本文介绍了进行检查(字符串结尾)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何检查java中的2个字符串结尾?使用布尔值,等号等。
我尝试过:
工作
How to check 2 String endings in java? Use boolean, equals, etc..
What I have tried:
Worked
推荐答案
将问题分解成部分:
1.你会如何比较任何两个字符串是否相等? (提示:是否有一个运算符比较字符串的内容是否相等?)
2.给定一个字符串,如何从字符串中提取最后的 j 个字符? (你似乎已经解决了这个问题)
3.全部放在一起
你有大部分的解决方案;你需要的就是一点点额外的一点。
Break the problem down into parts:
1. How would you compare any two strings for equality? (Hint: is there an operator that compares strings for the equality of their contents?)
2. Given a string, how would you extract the last j characters from the string? (you appear to have solved that)
3. Put it all together
You have most of the solution; all you need is that one little extra bit.
这篇关于进行检查(字符串结尾)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文