anybody can tell me how to add two strings without space between them
for example string1= string2 & string3
Printable View
anybody can tell me how to add two strings without space between them
for example string1= string2 & string3
well what you have posted works just the way you want it
yes but in string1 it is a space between two strings(string1 and string2)
but i want it without space
That means there is a space at the start or end of one of your strings. Try:
VB Code:
string1= RTrim$(string2) & LTrim$(string3)
what do you mean? do you mean that there is a space in string 1
if you want no spaces then you can use
then do your codeVB Code:
replace(string1," ", "") replace(string2," ", "")
many thanks you saved me!!!!!!!!
:thumb:
Don't forget to mark this thread resolved
Just to add, you didn't have to do it twice if all you want is string1 without space:Quote:
Originally Posted by d3gerald
VB Code:
string1 = Replace((string2 + string3), " ", "")
Also if this thread have been resovled place click on Thread Tools -> Mark Thread Resolved
wiz126 : nice, but instead of using + use & because if the variables are just numbers it will add those
Not to critisize, but removing all spaces from a string might not be wise.
The spaces inside the string might be part of it (a sentence or something).
Best is to trim the spaces of the ends.
point to be noted... :thumb:Quote:
Originally Posted by ganeshmoorthy
VB Code:
string1 = Trim(string2) & Trim(string3)
He may not want to remove the leading spaces of string2 or the trailing spaces of string3.Quote:
Originally Posted by Datacide