to 9.1 Parameters: to - the end number closure - the code to execute for each number Since: 1. public void upto( Number to, Closure closure).Truncate the value Parameters: precision - the number of decimal places to keep Returns: a BigDecimal truncated to the number of decimal places specified by precision Since: 2.5.0 See Also: BigDecimal#trunc() Truncate the value Returns: a BigDecimal truncated to 0 decimal places Since: 2.5.0 See Also: BigDecimal#trunc(int) Parameters: precision - the number of decimal places to keep Returns: a BigDecimal rounded to the number of decimal places specified by precision Since: 2.5.0 See Also: BigDecimal#round() BigDecimal#round() The precision argument specifies the number of digits to the right of This method operates on the fractional part of the number and Returns: the rounded value of that BigDecimal Since: 2.5.0 See Also: BigDecimal#round(int) BigDecimal#round()ĭigit. This method rounds the integral part to the nearest whole number. Parameters: exponent - an Integer exponent Returns: a Number to the power of the exponentĭigit. If theĮxponent is positive, call the BigDecimal.pow(int) method to Power of a BigDecimal to an integer certain exponent. Types in Groovy Parameters: right - a BigInteger Returns: the multiplication of left by right Since: 1.0 BigInteger is the fallback for all integer public Number multiply( BigInteger right)īigDecimal*long = long.Parameters: right - a Double Returns: the multiplication of left by right Since: 1.0 Over Number, the Number*Number method is not chosen as in older Multiply(BigDecimal) method in BigDecimal would respondĪnd return a BigDecimal instead. Note: This method was added to enforce the Groovy rule ofīigDecimal*Double = Double. Parameters: right - a BigDecimal Returns: true if left is equal to or bigger than right Since: 3.0.1 The class comes with a bunch of overloaded parse. JsonSlurper is a class that parses JSON text or reader content into Groovy data structures (objects) such as maps, lists and primitive types like Integer, Double, Boolean and String. String str '122.111' double dnum Double.valueOf(str) The value of dnum would be 122.111 after conversion. public Boolean isAtLeast( BigDecimal right)Ī fluent api style alias for compareTo. The classes dedicated to JSON serialisation and parsing are found in the groovy.json package. Java Convert String to Double using Double.valueOf (String) The valueOf () method of Double wrapper class in Java, works similar to the parseDouble () method that we have seen in the above java example.Parameters: right - a String representing a number Returns: true if left is equal to or bigger than the value represented by right Since: 3.0.1 public Boolean isAtLeast( String right)Ī fluent api style alias for compareTo.Parameters: to - the end number closure - the code to execute for each number Since: 1.0 public void downto( Number to, Closure closure)ĭecrementing by one each time.Methods inherited from interface java.lang.ObjectĪddShutdownHook, any, any, asBoolean, asType, collect, collect, collect, dump, each, eachMatch, eachMatch, eachWithIndex, every, every, find, find, findAll, findAll, findIndexOf, findIndexOf, findIndexValues, findIndexValues, findLastIndexOf, findLastIndexOf, findResult, findResult, findResult, findResult, getAt, getMetaClass, getMetaPropertyValues, getProperties, grep, grep, hasProperty, identity, inject, inject, inspect, invokeMethod, is, isCase, isNotCase, iterator, metaClass, print, print, printf, printf, println, println, println, putAt, respondsTo, respondsTo, setMetaClass, split, sprintf, sprintf, stream, tap, toString, use, use, use, with, with, withCloseable, withStream, withTraits ![]() Methods inherited from class java.lang. ![]() ![]() NumberĪbs, and, asBoolean, asType, bitwiseNegate, compareTo, compareTo, div, div, downto, intdiv, intdiv, isCase, isNotCase, leftShift, minus, minus, mod, multiply, multiply, next, or, plus, plus, plus, power, previous, rightShift, rightShiftUnsigned, step, times, toBigDecimal, toBigInteger, toDouble, toFloat, toInteger, toLong, unaryMinus, unaryPlus, upto, xor
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |