473,320 Members | 2,164 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# equivalent to VB instr functin

Is there a C# equivalent to VB's instr function to determine if the contents
of one string are present in another?

Brad
Nov 16 '05 #1
3 43757
Use the IndexOf method of the String class

String str = "longstring";
Int32 i = str.IndexOf("string");

In this case, i = 4.
"Brad Markisohn" <db*********@indesign-llc.com> wrote in message
news:Oq**************@tk2msftngp13.phx.gbl...
Is there a C# equivalent to VB's instr function to determine if the
contents
of one string are present in another?

Brad

Nov 16 '05 #2
IndexOf
--
Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers
"Brad Markisohn" <db*********@indesign-llc.com> wrote in message
news:Oq**************@tk2msftngp13.phx.gbl...
Is there a C# equivalent to VB's instr function to determine if the contents
of one string are present in another?

Brad

Nov 16 '05 #3
Thanks. That's just what I needed.

Brad

"Jim Hughes" <NO*********@Hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Use the IndexOf method of the String class

String str = "longstring";
Int32 i = str.IndexOf("string");

In this case, i = 4.
"Brad Markisohn" <db*********@indesign-llc.com> wrote in message
news:Oq**************@tk2msftngp13.phx.gbl...
Is there a C# equivalent to VB's instr function to determine if the
contents
of one string are present in another?

Brad


Nov 16 '05 #4

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

Similar topics

5
by: DTB | last post by:
I am trying to convert a complex function from Oracle to SQL Server and have come across Oracle's Instr() function. I see SQL Server has CHARINDEX() which is similar, however it does not provide...
1
by: Icaro | last post by:
Hi everybody, I was looking for an equivalent ORACLE INSTR Function in MSSQL but I don´t found it and I don´t know if it exist so I must to write it and this is the code. Maybe it will be...
11
by: (Pete Cresswell) | last post by:
I'd like to avoid coding a long set of IF... OR IF...statements. I can do a Select Case, but that would only let me case out on a single value. What I'm looking for is something like If...
6
by: Patrick A | last post by:
All - I have the following in the Field row of a column in a query that runs fine against a local table: MSA: InStr(!!,!) I'm now trying to run the query against a linked DB2 table. I get...
2
by: Reb | last post by:
hi, any function in C# that is equivalent to instr or instrRev? Thx
4
by: Mike P | last post by:
What is the C# equivalent of Left in VB6? I'm not sure how to translate this line of code : strResultCode = Left$(txtOutput, InStr(1, txtOutput, ",") - 1) Any help would be really...
4
by: cloudx | last post by:
hi there, how do I translate the following vb code to C#? I know to use Indexof, but what would be for """"? Thanks! InStr(1, sDocName, """")
4
by: fischerspooner | last post by:
Hi, I'm banging my head against the desk because I can't find a solution for the following simple problem. Case: There is a column in a table that has FamilyName and FirstName(s) in one field....
12
by: rodchar | last post by:
hey all, i'm getting a result that i don't understand i have a string "test1, test2" If InStr("test1") and InStr("test2") Then 'Inside EndIf The inside is not running for some reason. Any...
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
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.