473,378 Members | 1,372 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Question about String in mc++

Hello. In C# you can do like this:
int a = 5, b = 10;
string s = "blabla bla" + a + "bla bla bla" + b + ".";

How do you do that in mc++?
Nov 16 '05 #1
4 1217
String::Concat

a/b.ToString()

"Ereinion" <er*************@hotmail.com> wrote in message
news:2e**************************@posting.google.c om...
Hello. In C# you can do like this:
int a = 5, b = 10;
string s = "blabla bla" + a + "bla bla bla" + b + ".";

How do you do that in mc++?

Nov 16 '05 #2
"Pent" <pent> wrote in message news:<O9**************@tk2msftngp13.phx.gbl>...
String::Concat

a/b.ToString()

"Ereinion" <er*************@hotmail.com> wrote in message
news:2e**************************@posting.google.c om...
Hello. In C# you can do like this:
int a = 5, b = 10;
string s = "blabla bla" + a + "bla bla bla" + b + ".";

How do you do that in mc++?


If I want the String to be exactly like the c# string, that code won't
do that, or? And if
String::Concat;
a/b.ToString();
does that, then please explain, because I don't understand.
Nov 16 '05 #3
int a = 5, b = 10;
String* s = String::Concat(a.ToString(), b.ToString());
s = String::Concat(s, S"blah");

"Ereinion" <er*************@hotmail.com> wrote in message
news:2e**************************@posting.google.c om...
"Pent" <pent> wrote in message

news:<O9**************@tk2msftngp13.phx.gbl>...
String::Concat

a/b.ToString()

"Ereinion" <er*************@hotmail.com> wrote in message
news:2e**************************@posting.google.c om...
Hello. In C# you can do like this:
int a = 5, b = 10;
string s = "blabla bla" + a + "bla bla bla" + b + ".";

How do you do that in mc++?


If I want the String to be exactly like the c# string, that code won't
do that, or? And if
String::Concat;
a/b.ToString();
does that, then please explain, because I don't understand.

Nov 16 '05 #4
s = String::Concat("blabla bla", a.ToString(), "bla bla bla", b.ToString());
// String::Concat supports 2 to 4 string instances
s = String::Concat(s, "."); // need to do the 5th one

is one way.

Creating a 5 element System::Array of Object*, initializing that with the
Strings and passing that to String::Concat in one go saves one string
allocation.

Note that the Whidbey version of C++ will make this much closer to the C#
support since we will both support implicit boxing and Param arrays.

Ronald Laeremans
Visual C++ team

"Ereinion" <er*************@hotmail.com> wrote in message
news:2e**************************@posting.google.c om...
"Pent" <pent> wrote in message

news:<O9**************@tk2msftngp13.phx.gbl>...
String::Concat

a/b.ToString()

"Ereinion" <er*************@hotmail.com> wrote in message
news:2e**************************@posting.google.c om...
Hello. In C# you can do like this:
int a = 5, b = 10;
string s = "blabla bla" + a + "bla bla bla" + b + ".";

How do you do that in mc++?


If I want the String to be exactly like the c# string, that code won't
do that, or? And if
String::Concat;
a/b.ToString();
does that, then please explain, because I don't understand.

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Daniel Lidström | last post by:
Hi, how would I do the following (in CSharp) with MC++? C#: namespace LX { public struct Declarations { public const string SchemaVersion = "1.0";
6
by: Nurchi BECHED | last post by:
I have a filename and its process id in brackets. The problem is, the filename can contain brackets and numbers in it, but the last number in the brackets is always the process id. Now, assume,...
2
by: Naveen Mukkelli | last post by:
Hi, I'm writing a client/server application using C#. The server accepts connecitons asynchronously, using BeginAccept/EndAccept. Is there any way we can write some unit tests(NUnit) to test...
5
by: SpotNet | last post by:
Hello NewsGroup, I have a custom class and a collection for that custom class that inherits CollectionBase. As such; public class MyClass { private string datamember1 = string.Empty,...
2
by: rmathieu | last post by:
Hi, I want to initialize a static String array in MC++. What I want to do is to initialize my String array like the C# way: new String {"11", "22"} but I could not find an equivalent in MC++. The...
1
by: Guoqi Zheng | last post by:
Sir, I am writing a script to remove html tag using Regular expression. For example, I have a string = "<td class="whatever" width=12>some content here</td>" What I want to return is "<td...
1
by: Simon | last post by:
Hi, I have a class that does not seem to work. I cannot see the problem, and the "fix" I have found does not help me understand what the problem was I know I don't need a copy constructor but...
11
by: Key9 | last post by:
Hi all This is an simple app : read cin and print to cout I want it's action like "cat" with out arguement. #include <iostream> #include <string> using namespace std;
20
by: David | last post by:
I feel like an idiot asking this but here goes: I understand the 'concept' of scope and passing data by value and/or by reference but I am confused on some specifics. class example{ int i; //my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.