String Concatenation & Removing Space

Discussion in 'ASP .Net' started by Sparky Arbuckle, Sep 1, 2005.

  1. I am able to build a string for a product revision and was curious
    about removing the space. The only way that I have successfully built
    the string was to use:

    a = integer
    strRevision = string

    ds.Tables("DataTable").Rows(i)("RevisionString") += strRevision & a &
    ","

    so if product A had 4 revisions, it would look like:
    A 1,A 2,A 3,A 4,

    I would like this to look like:

    A1,A2,A3,A4,etc...

    How would I go about doing this? Would I have to create a function that
    will Replace the space with ""?
     
    Sparky Arbuckle, Sep 1, 2005
    #1
    1. Advertising

  2. Sparky Arbuckle

    Ben Guest

    Try using Trim, Replace would work as well... strRevision.Trim

    HTH,
    Ben

    "Sparky Arbuckle" <> wrote in message
    news:...
    >I am able to build a string for a product revision and was curious
    > about removing the space. The only way that I have successfully built
    > the string was to use:
    >
    > a = integer
    > strRevision = string
    >
    > ds.Tables("DataTable").Rows(i)("RevisionString") += strRevision & a &
    > ","
    >
    > so if product A had 4 revisions, it would look like:
    > A 1,A 2,A 3,A 4,
    >
    > I would like this to look like:
    >
    > A1,A2,A3,A4,etc...
    >
    > How would I go about doing this? Would I have to create a function that
    > will Replace the space with ""?
    >
     
    Ben, Sep 1, 2005
    #2
    1. Advertising

  3. Sparky Arbuckle

    Clamps Guest

    ds.Tables("DataTable").Rows(i)("RevisionString")+=rtrim(ds.tables("DataTable
    ").rows(i)("RevisionString") & a & ","




    "Sparky Arbuckle" <> wrote in message
    news:...
    > I am able to build a string for a product revision and was curious
    > about removing the space. The only way that I have successfully built
    > the string was to use:
    >
    > a = integer
    > strRevision = string
    >
    > ds.Tables("DataTable").Rows(i)("RevisionString") += strRevision & a &
    > ","
    >
    > so if product A had 4 revisions, it would look like:
    > A 1,A 2,A 3,A 4,
    >
    > I would like this to look like:
    >
    > A1,A2,A3,A4,etc...
    >
    > How would I go about doing this? Would I have to create a function that
    > will Replace the space with ""?
    >
     
    Clamps, Sep 1, 2005
    #3
  4. Thanks for the trim suggestions. I copied & pasted Clamps' code sample
    and the end result wasn't what I expected.

    Before: A 1,A 2,A 3,A 4,A 5,
    After: 1,1,2,1,1,2,3,1,1,2,1,1,2,3,4,1,1,2,1,1,2,3,1,1,2,1,1,2,3,4,5,

    Am I doing something wrong here?
     
    Sparky Arbuckle, Sep 1, 2005
    #4
  5. Sparky Arbuckle

    Ben Guest

    Based on your original post I would try somthing like...

    ds.Tables("DataTable").Rows(i)("RevisionString") += RTrim(strRevision) & a &
    ","

    I don't know vb.net soo that code is a guess.

    Personally I'd do a standard trim, because your rtrim will only trimming
    trailing spaces.

    "Sparky Arbuckle" <> wrote in message
    news:...
    > Thanks for the trim suggestions. I copied & pasted Clamps' code sample
    > and the end result wasn't what I expected.
    >
    > Before: A 1,A 2,A 3,A 4,A 5,
    > After: 1,1,2,1,1,2,3,1,1,2,1,1,2,3,4,1,1,2,1,1,2,3,1,1,2,1,1,2,3,4,5,
    >
    > Am I doing something wrong here?
    >
     
    Ben, Sep 1, 2005
    #5
  6. Thanks Ben :)
     
    Sparky Arbuckle, Sep 1, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. walala
    Replies:
    3
    Views:
    4,857
    walala
    Sep 18, 2003
  2. Shuo Xiang

    Stack space, global space, heap space

    Shuo Xiang, Jul 9, 2003, in forum: C Programming
    Replies:
    10
    Views:
    2,955
    Bryan Bullard
    Jul 11, 2003
  3. Christian Seberino
    Replies:
    21
    Views:
    1,766
    Stephen Horne
    Oct 27, 2003
  4. Ian Bicking
    Replies:
    2
    Views:
    1,080
    Steve Lamb
    Oct 23, 2003
  5. Ian Bicking
    Replies:
    2
    Views:
    764
    Michael Hudson
    Oct 24, 2003
Loading...

Share This Page