473,561 Members | 3,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("Data Table").Rows(i) ("RevisionStrin g") += 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 1347
Ben
Try using Trim, Replace would work as well... strRevision.Tri m

HTH,
Ben

"Sparky Arbuckle" <tw*@secureroot .com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.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("Data Table").Rows(i) ("RevisionStrin g") += 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("Data Table").Rows(i) ("RevisionStrin g")+=rtrim(ds.t ables("DataTabl e
").rows(i)("Rev isionString") & a & ","


"Sparky Arbuckle" <tw*@secureroot .com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.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("Data Table").Rows(i) ("RevisionStrin g") += 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("Data Table").Rows(i) ("RevisionStrin g") += RTrim(strRevisi on) & 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.goo glegroups.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3669
by: Jonathan | last post by:
Why did the designers of PHP decide to use period (".") as the string concatenation operator rater than the obviously more logical plus ("+")? //JJ
8
3277
by: barry | last post by:
Have tried a number of things including space(n) in front of the string but when the DropDownList is shown the spaces have apparently been trimmed. Is this something that would have to be done in a custom control? I would like the spaces to be at the front end of the string " xxxxx". In vs.net I am doing a listitem(string) Any Help is...
16
2128
by: Mark A. Sam | last post by:
Hello, I am having a problem with imputting into a string variable: Dim strSQL As String = "INSERT INTO tblContactForm1 (txtName, txtCompany, txtPhone, txtEmail, txtComment, chkGrower, chkProduceDealer, txtOtherCustType, chkStandardBags, chkCustomBags,txtOtherBags) " + _ "VALUES ('" + txtName.Text + "','" + txtCompany.Text + "','" +...
33
4647
by: genc_ymeri | last post by:
Hi over there, Propably this subject is discussed over and over several times. I did google it too but I was a little bit surprised what I read on internet when it comes 'when to use what'. Most of articles I read from different experts and programmers tell me that their "gut feelings" for using stringBuilder instead of string concatenation...
12
2695
by: Richard Lewis Haggard | last post by:
I thought that the whole point of StringBuilder was that it was supposed to be a faster way of building strings than string. However, I just put together a simple little application to do a comparative analysis between the two and, surprisingly, string seems to out perform StringBuilder by a significant amount. A string concatenation takes not...
9
1395
by: Terry Olsen | last post by:
I send out a daily email to technicians regarding nightly backup logs. I use the following code to generate the body of the email: tmpBody += vbCrLf tmpBody += "----- " & SupTechs.Item(j) & " (" & tmpCount & " servers monitored) -----" tmpBody += vbCrLf tmpBody += <Specific Server Error Message> However, I get emails that sometimes have...
34
2626
by: Larry Hastings | last post by:
This is such a long posting that I've broken it out into sections. Note that while developing this patch I discovered a Subtle Bug in CPython, which I have discussed in its own section below. ____________ THE OVERVIEW I don't remember where I picked it up, but I remember reading years ago that the simple, obvious Python approach for...
13
2662
by: Tony Johansson | last post by:
Hello! I read in a book and here is a question and the answer that I'm not satisfied with. When should you use the StringBuilder class instead of the String class. 1.When building a string from shorter strings. 2.When working with text data longer than 256 bytes. 3.When you want to search and replace the contents of a string 4.When a...
1
2079
by: =?Utf-8?B?UGFzcXVhbGU=?= | last post by:
I want to send an email with smtpclient. I have created a MailMessage with body obtained as concatenation between a fixed string, that finishes with a space, and a string variable. The code is as this: MailMessage.Body = "Title " + strTitle. The variable strTitle is read from a SharePoint list. When I read the mail, I see that the space in...
0
7647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7859
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7618
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7930
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3617
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3600
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2068
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1181
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
896
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.