You are not logged in.

newser-sky

Beginner

  • "newser-sky" started this thread

Posts: 1

Date of registration: Mar 15th 2011

  • Send private message

1

Friday, March 18th 2011, 11:01am

formating numbers and decimals

we are from italy we need to know how format numbers with decimal.

thanks a lot

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

2

Friday, March 18th 2011, 2:15pm

Jabaco's implementation of Format() is not fully compatible to the VB6 format.

You can use your own formatting function from the Java API as follows:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Option Explicit

Public Sub Command1_Click()
      Debug.Print "1.414 " & nformat(1.414, "#.#")
      Debug.Print "0.99 " & nformat(0.9937, "##.0###%")      
End Sub


Public Function nformat(value As Double, Format As String) As String
   '  see http://download.oracle.com/javase/6/docs/api/java/text/DecimalFormat.html
   Dim df As New java#text#DecimalFormat(Format)
   
   nformat = df.format(value)
End Function


The format strings are described here.

Greetings

A1880

Rate this thread
WoltLab Burning Board