Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean sameStarChar(String str) {
- int length = str.length();
- if (length == 0) {
- return true;
- }
- for (int i = 1; i < (length - 1); i++) {
- if (str.charAt(i) == '*') {
- if (str.charAt(i - 1) != str.charAt(i + 1)) {
- return false;
- }
- }
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement