Results 1 to 4 of 4

Thread: replace 'Zero' to 'space'

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 1999
    Location
    Ruinen, Drente, Netherlands
    Posts
    192
    How can I replace the nummber '0' for a space ' ' ?
    (number = "00021" / must be " 21")

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946
    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

  3. #3
    Guest
    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/

  4. #4
    Guest
    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
  •  



Click Here to Expand Forum to Full Width