(String src, boolean before)
| 102 | } |
| 103 | |
| 104 | static int findBestIndex(String src, boolean before) { |
| 105 | int index = before ? src.lastIndexOf(' ') : src.indexOf(' '); |
| 106 | if (index == -1) |
| 107 | index = before ? 0 : src.length(); |
| 108 | else if (before) |
| 109 | index++; |
| 110 | |
| 111 | for (char c : MathParser.special) { |
| 112 | int id = before ? src.lastIndexOf(c) : src.indexOf(c); |
| 113 | if (id != -1) |
| 114 | index = before ? Math.max(index, id + 1) : Math.min(index, id); |
| 115 | } |
| 116 | |
| 117 | return index; |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * Calculates the similarity (a number within 0 and 1) between two strings. |
no test coverage detected