imbault Well-Known Member Licensed User Longtime User Sep 10, 2015 #1 Hi, Normal behavior is Log(NumberFormat(10, 4 ,0)) '"0010" I would like to get " 10", in fact space instead of 0 at the beg of string, is there a easy way, or do I have to write a small sub like B4X: Dim cNum As String cNum = NumberFormat(10, 4 ,0) Do While cNum.StartsWith("0") cNum = " " & cNum.SubString(1) Loop Thanks
Hi, Normal behavior is Log(NumberFormat(10, 4 ,0)) '"0010" I would like to get " 10", in fact space instead of 0 at the beg of string, is there a easy way, or do I have to write a small sub like B4X: Dim cNum As String cNum = NumberFormat(10, 4 ,0) Do While cNum.StartsWith("0") cNum = " " & cNum.SubString(1) Loop Thanks
Erel B4X founder Staff member Licensed User Longtime User Sep 10, 2015 #2 Another options: B4X: Sub PrefixWithSpaces(s As String, TotalLength As Int) As String For i = 1 To TotalLength - s.Length s = " " & s Next Return s End Sub Upvote 0
Another options: B4X: Sub PrefixWithSpaces(s As String, TotalLength As Int) As String For i = 1 To TotalLength - s.Length s = " " & s Next Return s End Sub
imbault Well-Known Member Licensed User Longtime User Sep 10, 2015 #3 Thx Erel, perfect, as usual... Patrick Upvote 0