MCPcopy Create free account
hub / github.com/BaseXdb/basex / chopNumber

Method chopNumber

basex-core/src/main/java/org/basex/util/Token.java:524–530  ·  view source on GitHub ↗

Finishes the numeric token, removing trailing zeroes. @param token token to be modified @return token

(final byte[] token)

Source from the content-addressed store, hash-verified

522 * @return token
523 */
524 public static byte[] chopNumber(final byte[] token) {
525 if(!contains(token, '.') || contains(token, 'e') || contains(token, 'E')) return token;
526 // remove trailing zeroes
527 int tl = token.length;
528 while(--tl > 0 && token[tl] == '0');
529 return substring(token, 0, token[tl] == '.' ? tl : tl + 1);
530 }
531
532 /** Constant float values. */
533 private static final float[] FLT = { 1.0E17f, 1.0E15f, 1.0E13f, 1.0E11f,

Callers 6

timeMethod · 0.95
stringMethod · 0.95
tokenMethod · 0.95
writeMethod · 0.80
stringMethod · 0.80
valueMethod · 0.80

Calls 2

containsMethod · 0.95
substringMethod · 0.95

Tested by

no test coverage detected