Checks whether this CharArray ends with the specified string. @return true if this CharArray ends with the string
(String str)
| 1418 | /** Checks whether this CharArray ends with the specified string. |
| 1419 | * @return true if this CharArray ends with the string */ |
| 1420 | public boolean endsWith (String str) { |
| 1421 | int length = str.length(); |
| 1422 | if (length == 0) return true; |
| 1423 | if (length > size) return false; |
| 1424 | int pos = size - length; |
| 1425 | for (int i = 0; i < length; i++, pos++) |
| 1426 | if (items[pos] != str.charAt(i)) return false; |
| 1427 | return true; |
| 1428 | } |
| 1429 | |
| 1430 | /** Copies this character array into the specified array. |
| 1431 | * @param target the target array, null will cause an array to be created |