Blueforcer Well-Known Member Licensed User Longtime User Jan 10, 2019 #1 Im searching for a solution to do numeric format strings in B4A and B4J https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings especially i need Digit placeholder and Decimal point. for example i had a raw value of 700 with a mask of "x.xx" i need to convert it to 7.00 Is there a function for something like that?
Im searching for a solution to do numeric format strings in B4A and B4J https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings especially i need Digit placeholder and Decimal point. for example i had a raw value of 700 with a mask of "x.xx" i need to convert it to 7.00 Is there a function for something like that?
DonManfred Expert Licensed User Longtime User Jan 10, 2019 #2 Microsoft docs are not relevant in Android. Search Android docs for any relevant Info. Upvote 0
Blueforcer Well-Known Member Licensed User Longtime User Jan 10, 2019 #3 Of course i know its not relevant. Im searching for a similar possibility. The given Link is just to show my needs. I didnt find anything about android, but maybe someone has reprogrammed something similar here. Upvote 0
Of course i know its not relevant. Im searching for a similar possibility. The given Link is just to show my needs. I didnt find anything about android, but maybe someone has reprogrammed something similar here.
Erel B4X founder Staff member Licensed User Longtime User Jan 10, 2019 #4 The standard way to format numbers is with NumberFormat or NumberFormat2. AHLocale library adds more options: https://www.b4x.com/android/forum/threads/ahlocale-library.7561/#content And you can always format it yourself: B4X: Sub StrangeFormatNumberWithDot (n As Float) As String Dim s As String = NumberFormat2(n, 1, 0, 0, False) If s.Replace("-", "").Length >= 3 Then s = s.SubString2(0, s.Length - 2) & "." & s.SubString(s.Length - 2) Return s End Sub Upvote 0
The standard way to format numbers is with NumberFormat or NumberFormat2. AHLocale library adds more options: https://www.b4x.com/android/forum/threads/ahlocale-library.7561/#content And you can always format it yourself: B4X: Sub StrangeFormatNumberWithDot (n As Float) As String Dim s As String = NumberFormat2(n, 1, 0, 0, False) If s.Replace("-", "").Length >= 3 Then s = s.SubString2(0, s.Length - 2) & "." & s.SubString(s.Length - 2) Return s End Sub