Results 1 to 5 of 5

Thread: Deleting spaces in the middle of a sting [RESOLVED]

  1. #1

    Thread Starter
    Addicted Member DKasler's Avatar
    Join Date
    Jan 2005
    Location
    Brooklyn, NYC
    Posts
    177

    Resolved Deleting spaces in the middle of a sting [RESOLVED]

    How do i delete spaces in the middle of a string?

    I have txt box droping a value with a space into a string, but I need to stip the spaces from the middle of the value.

    "New Record" needs to become "NewRecord"

    Thanks in advance.
    Last edited by DKasler; Feb 8th, 2005 at 01:35 PM.
    -----MY SITES-----
    BayRidgeNights.Com - NYC Nightlife Forums

    Fight Communism - Rate Posts!

  2. #2
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: Deleting spaces in the middle of a sting

    Quote Originally Posted by DKasler
    How do i delete spaces in the middle of a string?

    I have txt box droping a value with a space into a string, but I need to stip the spaces from the middle of the value.

    "New Record" needs to become "NewRecord"

    Thanks in advance.
    Ok you can use the Split function and then the Join function

    VB Code:
    1. Dim tempArray() As String
    2. Dim myString As String
    3.  
    4. tempArray = Split(Text1.Text, " ") 'remove the space and store each word in a rray
    5.  
    6. myString = Join(tempArray, "") 'join back together again
    7.  
    8. Text1.Text = myString 'display

    for a full explination on these 2 function have a look in my sig and click on Useful Vb function

    Hope that helps

  3. #3

    Thread Starter
    Addicted Member DKasler's Avatar
    Join Date
    Jan 2005
    Location
    Brooklyn, NYC
    Posts
    177

    Re: Deleting spaces in the middle of a sting

    Thanks alot. That did EXACTLY what I needed.
    -----MY SITES-----
    BayRidgeNights.Com - NYC Nightlife Forums

    Fight Communism - Rate Posts!

  4. #4
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: Deleting spaces in the middle of a sting

    Quote Originally Posted by DKasler
    Thanks alot. That did EXACTLY what I needed.
    No problem glad to help, if you could mark this resolved and carry out any ratings

    Glad you solved it (I'm sure there is an easyer way of doing it I just cant remember)

    Anyways glad its sorted.

    Liam

  5. #5
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Deleting spaces in the middle of a sting [RESOLVED]

    Eloquent solution squirrel man.

    You could even make it more compact with
    VB Code:
    1. Text1 = Join(Split(X, " "), "")

    ...

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