|
-
Aug 3rd, 2000, 03:35 PM
#1
Thread Starter
Addicted Member
How can I replace the nummber '0' for a space ' ' ?
(number = "00021" / must be " 21")
-
Aug 3rd, 2000, 03:50 PM
#2
_______
NewNum = Format(Number,"#####")
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Aug 3rd, 2000, 03:51 PM
#3
Assuming your variable, "Number" is a string, a simple Val command is all you need:
Code:
number = Val(number)
-Joe Jordan
Ignite Software
http://www.IgniteSoft.com/
-
Aug 3rd, 2000, 03:56 PM
#4
Use the Recplace() function. (VB6 Only).
Code:
Text1 = Replace(Text1, "0", "")
If you have VB5, you can use the following duplication.
Code:
Public Function Replace(sIn As String, sFind As String, _
sReplace As String, Optional nStart As Long = 1, _
Optional nCount As Long = -1, Optional bCompare As _
VbCompareMethod = vbBinaryCompare) As String
Dim nC As Long, nPos As Integer, sOut As String
sOut = sIn
nPos = InStr(nStart, sOut, sFind, bCompare)
If nPos = 0 Then GoTo EndFn:
Do
nC = nC + 1
sOut = Left(sOut, nPos - 1) & sReplace & _
Mid(sOut, nPos + Len(sFind))
If nCount <> -1 And nC >= nCount Then Exit Do
nPos = InStr(nStart, sOut, sFind, bCompare)
Loop While nPos > 0
EndFn:
Replace = sOut
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|