aaronk Well-Known Member Licensed User Longtime User Dec 15, 2012 #1 Hello, What would be the easiest way to remove leading zeros in a number? For Example: 008 should return 8 087 should return 87
Hello, What would be the easiest way to remove leading zeros in a number? For Example: 008 should return 8 087 should return 87
aaronk Well-Known Member Licensed User Longtime User Dec 15, 2012 #3 Hello, Here is what I have tried.. This works: B4X: Log(NumberFormat(007, 1 ,0)) ' Logs 7 - (which is what I want) Log(NumberFormat(187, 1 ,0)) ' Logs 187 - (which is what I want) This doesn't work: B4X: Log(NumberFormat(087, 1 ,0)) ' Error Comes up with this error: integer number too large: 087 Am I using / doing it correct? Upvote 0
Hello, Here is what I have tried.. This works: B4X: Log(NumberFormat(007, 1 ,0)) ' Logs 7 - (which is what I want) Log(NumberFormat(187, 1 ,0)) ' Logs 187 - (which is what I want) This doesn't work: B4X: Log(NumberFormat(087, 1 ,0)) ' Error Comes up with this error: integer number too large: 087 Am I using / doing it correct?
Theera Well-Known Member Licensed User Longtime User Dec 15, 2012 #4 Try use regex.replace("0"," ") Best Regards Theera Upvote 0
M Mahares Expert Licensed User Longtime User Dec 15, 2012 #5 You can use something like this: B4X: Dim dblVal As Double Dim strVal As String ="087" dblVal= strVal Msgbox(dblVal,"") 'returns 87 Upvote 0
You can use something like this: B4X: Dim dblVal As Double Dim strVal As String ="087" dblVal= strVal Msgbox(dblVal,"") 'returns 87