Makes degrees readable for Math trigonometry functions x° => toRadians(x)
(String src)
| 210 | * x° => toRadians(x) |
| 211 | */ |
| 212 | private String fixDegrees(String src) { |
| 213 | char deg = '°'; |
| 214 | // 24deg | 24degrees => 24° |
| 215 | // 24rad | 24 radian | 24radians => 24 |
| 216 | if (getVariable("degrees") == null) |
| 217 | src = src.replaceAll("(?<=\\d)degrees(?=[^\\w]|$)", String.valueOf(deg)); |
| 218 | if (getVariable("deg") == null) |
| 219 | src = src.replaceAll("(?<=\\d)deg(?=[^\\w]|$)", String.valueOf(deg)); |
| 220 | if (getVariable("radians") == null) |
| 221 | src = src.replaceAll("(?<=\\d)radians(?=[^\\w]|$)", ""); |
| 222 | if (getVariable("radian") == null) |
| 223 | src = src.replaceAll("(?<=\\d)radian(?=[^\\w]|$)", ""); |
| 224 | if (getVariable("rad") == null) |
| 225 | src = src.replaceAll("(?<=\\d)rad(?=[^\\w]|$)", ""); |
| 226 | |
| 227 | return fix(src, "toRadians", deg); |
| 228 | } |
| 229 | |
| 230 | /** |
| 231 | * Makes factorial readable |
no test coverage detected