471,306 Members | 839 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,306 software developers and data experts.

String Concatenation & Removing Space

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 ""?

Nov 19 '05 #1
5 1272
Ben
Try using Trim, Replace would work as well... strRevision.Trim

HTH,
Ben

"Sparky Arbuckle" <tw*@secureroot.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
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 ""?

Nov 19 '05 #2
ds.Tables("DataTable").Rows(i)("RevisionString")+= rtrim(ds.tables("DataTable
").rows(i)("RevisionString") & a & ","


"Sparky Arbuckle" <tw*@secureroot.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
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 ""?

Nov 19 '05 #3
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?

Nov 19 '05 #4
Ben
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" <tw*@secureroot.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
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?

Nov 19 '05 #5
Thanks Ben :-)

Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Jonathan | last post: by
16 posts views Thread by Mark A. Sam | last post: by
12 posts views Thread by Richard Lewis Haggard | last post: by
9 posts views Thread by Terry Olsen | last post: by
34 posts views Thread by Larry Hastings | last post: by
13 posts views Thread by Tony Johansson | last post: by
1 post views Thread by =?Utf-8?B?UGFzcXVhbGU=?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.