Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2004

Tip: Looking for answers? Try searching our database.

How can I join Strings?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David - 05 May 2004 21:37 GMT
String* str1;

String* str2;

String* s;

str1="Rado";

str2="Robes";

s= str1 + ' ' + str2;

But VC++ write me error> d:\My projects\Visual C++\listview\Form1.h(125):
error C2845: '+' : cannot perform pointer arithmetic on __gc pointer
'System::String __gc *'

BUT when I declare "Strings str;" It's bad too.

Where can be problem?

How can I join strings for example 7 strings and in the middle of each
string will be space?

Thanks.
mccoyn - 06 May 2004 01:26 GMT
String::Concat will join 2 strings

String* str1
String* str2
String* str3

str1 = "Hello "
str2 = "World"
str3 = String::Concat(str1, str2)

You can also use String::Format, which is similiar to sprintf, but it takes advantage of type checking in .Net

String* str1
String* str2
String* str3

str1 = "Hello"
str2 = "World"
str3 = String::Format("{0} {1}", str1, str2);

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.