473,320 Members | 2,035 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,320 software developers and data experts.

C# string method equiivalent to C++ CString SpanExcluding?

WRH
Hello
Is there a C# string method or short algorithm equivalent to CString
SpanExcluding?
Nov 17 '05 #1
2 5561

"WRH" <no*****@videotron.ca> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hello
Is there a C# string method or short algorithm equivalent to CString
SpanExcluding?


Something like this maybe?

string s = "Visual Studio '2005'";
char[] p = {';', '-', '\''}; // last character is escaped apostrophe
(') !!
Console.WriteLine(s.Substring(0,s.IndexOfAny(p)));

Willy.

Nov 17 '05 #2
WRH
Thanks! I'll use this.

"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:u7**************@TK2MSFTNGP12.phx.gbl...

"WRH" <no*****@videotron.ca> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hello
Is there a C# string method or short algorithm equivalent to CString
SpanExcluding?


Something like this maybe?

string s = "Visual Studio '2005'";
char[] p = {';', '-', '\''}; // last character is escaped apostrophe
(') !!
Console.WriteLine(s.Substring(0,s.IndexOfAny(p)));

Willy.

Nov 17 '05 #3

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

Similar topics

23
by: YinTat | last post by:
Hi, I learned C++ recently and I made a string class. A code example is this: class CString { public: inline CString(const char *rhs) { m_size = strlen(rhs);
2
by: Javier | last post by:
Hi All I'm in a nightmare trying to do a simple c++ program... I want to read a file that will have strings in a vector. The path where is the file is in a ini file. I did:
12
by: Generic Usenet Account | last post by:
Is it that I am blurry eyed, or is it indeed that the C++ string class has no tokenizer method defined? I have defined my own functions , but I would prefer to use the standard functions, if...
1
by: SteveK | last post by:
Trying to wrap an unmanaged class. Here is the function I'm trying to wrap: bool Init(PCSTR filename, PCSTR username, PCSTR password, PCSTR working); In my managed C++ class, I have a method...
22
by: Michael Rasmussen | last post by:
Hi all, Not sure if this is OT? I have a function in a library written in C++ which returns a strdup(s.c_str()) to an application written i C. Running Valgrind on my C-application shows this...
1
by: shama | last post by:
Hi all, I am using BSTR data type for storing string and want to remove special character (# ' : )from that string. Is there any function for this.... As CString class has "SpanExcluding". or...
30
by: nano2k | last post by:
Hi I need an efficient method to convert a string object to it's byte equivalent. I know there are LOTS of methods, but they lack in efficiency. All methods allocate new memory to create the byte...
5
by: =?Utf-8?B?VG9tYXM=?= | last post by:
Hello all. Is there some class similar to CString::ReverseFind(...) in .NET?. // Example for CString::ReverseFind CString s( "abcabc" ); ASSERT( s.ReverseFind( 'b' ) == 4 ); Thanks --
4
Claus Mygind
by: Claus Mygind | last post by:
In my code I am sending a number of records via an ajax post method to the web-server for updating a table. I will parse the query string when it is received on the server side. But I am not sure...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.