Thank Shan, this is exactly what I wanted.

*Regards,*


*Ishara Ilangasinghe*

*Associate Software Engineer | WSO2*

*Email: [email protected] <[email protected]>*
*Mobile: +94719718288*


[image: http://wso2.com/signature] <http://wso2.com/signature>


On Fri, Apr 12, 2019 at 11:02 AM Shan Mahanama <[email protected]> wrote:

> Hi Ishara,
>
> I think what you are looking for is io:sprintf().
>
> Eg -
>
> float f = 123.4567;
> // This will format the floating point number to 2 decimal points.
> io:println(io:sprintf("%.2f", f));
>
> More info on sprintf function is available at
> https://ballerina.io/learn/api-docs/ballerina/io.html#sprintf.
> Thanks,
> Shan.
>
> On Fri, Apr 12, 2019 at 10:50 AM Ishara Ilangasinghe <[email protected]>
> wrote:
>
>> Hi All,
>>
>> I want to limit the number of decimal points in a float value, I don't
>> want to round off the value rather format it. Is there a specific method
>> like JavaScript toFixed() in Ballerina 0.990.2. for this?
>>
>> [1]
>> https://stackoverflow.com/questions/55644825/ballerina-function-to-limit-the-decimal-points-in-a-float
>>
>>
>> *Regards,*
>>
>>
>> *Ishara Ilangasinghe*
>>
>> *Associate Software Engineer | WSO2*
>>
>> *Email: [email protected] <[email protected]>*
>> *Mobile: +94719718288*
>>
>>
>> [image: http://wso2.com/signature] <http://wso2.com/signature>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>
>
> --
>
> *Shan Mahanama* | Senior Software Engineer | WSO2 Inc.
> (m) +94 71 2000 498 | (w) +94 11 743 5800
>
>
>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to