Results 1 to 2 of 2

Thread: " " = " "

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Posts
    482

    Talking

    Hey, how do i make it so in a string, say
    MESSAGE

    it'll take any SPACES and put them as only ONE.

    like
    if Message= "Hey Man WHAT U UP TO ?"

    it'll become
    "Hey Man WHAT U UP TO ?"

  2. #2
    Addicted Member
    Join Date
    Jan 2000
    Location
    Sydney, Australia
    Posts
    196
    Both of those strings are the same...

    do you mean you want to make:

    Code:
    "Hey    man  what     you up to?"
    
    'go to
    
    "Hey man what you up to?"
    '??
    well - if so, this might seem a bit dodgy but you could do this:

    Code:
    Dim TheString As String
    Dim TempString As String
    
    'Set up the strings
    TheString = "Hey    man  what     you up to?"
    TempString = ""
    
    'Replace 2 spaces "  " with one space " " as long as
    'the last replace actually made a change. When no change
    'then stop replacing.
    Do While TempString <> TheString
        TempString = TheString
        TheString = Replace(TheString, "  ", " ")
    Loop
    
    MsgBox TheString
    hope this is what you meant...

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