Results 1 to 4 of 4

Thread: Replace function

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2011
    Posts
    2

    Replace function

    Hello guys,

    I am using a software that graps informations from web-sites. But i want to something on those information. For doing that, it allows me make a VB script. Actually i have never studied any Vb code. But i found a solution for my project.
    The data from that website is for exmp. "1.02.30" i want to change first dot into semi colon and the second dot into comma, namely "1:20,30". I found replace function and it works if i want to do "1:20:30" that. But i have to change first dot into semi colon and the second dot into comma. Any ideas ?

    Thanks.

  2. #2
    New Member
    Join Date
    Jun 2011
    Posts
    6

    Re: Replace function

    why not do a replace on the first set of characters only.
    maybe
    Code:
    REPLACE(LEFT([your string],3,".",";)
    then follow that by a
    Code:
    REPLACE([Your New String],".",":")
    Scott

  3. #3
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,714

    Re: Replace function

    Code:
            Dim Parts() As String = "1.02.30".Split(".".ToCharArray)
            Console.WriteLine( _
                String.Concat( _
                    Parts(0), _
                    ":", _
                    Parts(1), _
                    ",", _
                    Parts(2) _
                ) _
            )

  4. #4

    Thread Starter
    New Member
    Join Date
    Jun 2011
    Posts
    2

    Re: Replace function

    Quote Originally Posted by kevininstructor View Post
    Code:
            Dim Parts() As String = "1.02.30".Split(".".ToCharArray)
            Console.WriteLine( _
                String.Concat( _
                    Parts(0), _
                    ":", _
                    Parts(1), _
                    ",", _
                    Parts(2) _
                ) _
            )
    Thank you. It gave an idea.

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