473,793 Members | 2,810 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1233
String::Concat

a/b.ToString()

"Ereinion" <er************ *@hotmail.com> wrote in message
news:2e******** *************** ***@posting.goo gle.com...
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******* *******@tk2msft ngp13.phx.gbl>. ..
String::Concat

a/b.ToString()

"Ereinion" <er************ *@hotmail.com> wrote in message
news:2e******** *************** ***@posting.goo gle.com...
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.goo gle.com...
"Pent" <pent> wrote in message

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

a/b.ToString()

"Ereinion" <er************ *@hotmail.com> wrote in message
news:2e******** *************** ***@posting.goo gle.com...
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.goo gle.com...
"Pent" <pent> wrote in message

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

a/b.ToString()

"Ereinion" <er************ *@hotmail.com> wrote in message
news:2e******** *************** ***@posting.goo gle.com...
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
1264
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
1457
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, the process name (3344 is the id): myfilename.something else ()(321) (3344) (the actual filename is "myfilename.something else ()(321) (3344).exe")
2
3222
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 the behaviour of accepting connections and testing some other private methods that would be called when the server receives a connection request.
5
1859
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, datamember2 = string.Empty; private int datamember3 = -1;
2
1915
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 onlu thing I can do is this: new String* but I cannot specified any initial values... Did someone have any ideas??? Here is an example of what I want to do: C# struct TestingStruct {
1
919
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 class="whatever" width=12>", I used pattern = "<td(.*)>"
1
5241
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 the class might grow later and I prefer having my copy constructor. This also explains why I have 2 similar function "ClearAll() and NullAll()" they might be used later in case I have pointers.
11
427
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
1924
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 global var private void method1(int myInt){ int x; //local var etc...
0
9671
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9518
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10212
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10161
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6777
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.