Newbie Questions

Bruno

Member
Licensed User
Hi there,

Two little questions:

How to dispaly (using 'Format')
1.2345678 like this 001.123
something like Format(1.23456,"D3F3") ?

and then

Dim Type (name,age) person
Dim Type (name,age) other_person

How to copy directly person => other_person

whithout made:
other_person.name=person.name
other_person.age=person.age

Many thanks !!!!!
Bruno.
 

Erel

Administrator
Staff member
Licensed User
You can copy the struct with ArrayCopy:
B4X:
ArrayCopy(person(),0,2,other_Person(),0)
Format:
You will need to treat differently the whole part and the fraction part.
B4X:
Sub App_Start
    Msgbox(SpecialFormat(1.2345678)) 'will display 001.235
End Sub

Sub SpecialFormat(num)
    frac = Format(num - Int(num),"F3")
    Return Format(Int(num),"d3") & SubString(frac,1,StrLength(frac)-1)
End Sub
 
Top