[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Format and Format$
[Thread Prev] | [Thread Next]
- Subject: Re: Format and Format$
- From: Karl Reinl <karl.reinl@xxxxxxxxxx>
- Reply-to: karl.reinl@xxxxxxxxxx
- Date: Sun, 12 Jan 2025 15:53:15 +0100
- To: user@xxxxxxxxxxxxxxxxxxxxxx
Am Sonntag, dem 12.01.2025 um 14:31 +0100 schrieb Gianluigi:
> Il 12/01/25 11:35, Charlie Reinl ha scritto:
> > Salut,
> >
> > I have to represent strings like "17,4" or "12" or "0" or "1.001,5"
> > always with 2 or 4 digits, and there is the problem, the current
> > language is 'de_DE' but for the decimal separator I need a dot
> > like in
> > 'en_EN'.
> > Format prints me "17,4000", but I need "17.4000"
> > Is there a way to achieve this with Format, or do I need to use
> > REPLACE?
> >
>
> Hi,
>
> Something like that?
>
> Public Sub Form_Open()
>
> TextBox1.Text = LangFormat("en_US.UTF-8", "17,4000")
> TextBox2.Text = LangFormat("de_DE.UTF-8", "17,4000")
>
> End
>
> Private Sub LangFormat(sLang As String, s As String) As String
>
> Dim i As Integer
> i = ReturnInteger(s)
>
> System.Language = sLang
> s = Format((i / 10000), "#.0000")
> Return s
>
> End
>
> Private Sub ReturnInteger(sText As String) As Integer
>
> Dim i As Integer
>
> If sText Then
> sText = Replace(sText, ",", "")
> i = Val(sText)
> Endif
> Return i
>
> End
>
>
Salut,
thanks, System.Language is better than a REPLACE
--
Amicalement
Charlie
| Format and Format$ | Charlie Reinl <Karl.Reinl@xxxxxxxxxx> |
| Re: Format and Format$ | Gianluigi <gradobag@xxxxxxxxxxx> |