Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String functions in C#

Status
Not open for further replies.

PIAS

Programmer
Nov 2, 2005
38
0
0
SI
Hi can someone tell me how to convert this code from VB to C#;

if (InStr(Request.Form.Keys[n], "dolzinaFc") != 0)

the stress is on InStr


Thanks!
 
Look up IndexOf

= -1 means that it wasn't found

if not (Request.Form.Keys[n].IndexOf("dolzinaFc") = -1)
{
}

This is not tested
 


Sory but,
this links are useless, for instance when i type in the window this code:

if (InStr(Request.Form.Keys[n], "dolzinaFc") != 0)

and pres button: Convert to C#, it gives me result like this:

Below is the result of the conversion.

An error occured while processing your code: -- line 3 col 29: ")" expected


OR when i type in just this; InStr

it returns this:

Below is the result of the conversion.
private object InStr;

but this code i haven't find in C# am i missing something or this translator doesen't work right.

On the other translator on this page:

i did not find conversion from VB to C#

Thanks anyway

P.
 
What about conversion of this code from VB:

CompareMethod.Binary

to C#: ?
 
and this from VB

ReDim Preserve dnevi(i);

to C#:


Thanks!
 
Sory but,
this links are useless, for instance when i type in the window this code:

if (InStr(Request.Form.Keys[n], "dolzinaFc") != 0)

and pres button: Convert to C#, it gives me result like this:
It would help if you had valid VB.NET code to start with. The above isn't.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
The best way to do converstions is to know both languages. The best part of this is you'll be more valuable as a programmer $$$$

Here are some links to that end

This book is $6. I think everyone should own this book, even if you don't want to learn the other language

COnvertes are only a good way to get the bulk code converted.

I have heard of people compiling dll's and then disassembling them in their preferred language. PITA if you ask me.
 
All converters are not created equal. These guys have the best I've seen:
There are paid and free demo versions available.

[sub]Jeff
[purple]It's never too early to begin preparing for [/purple]International Talk Like a Pirate Day

"The software I buy sucks, The software I write sucks. It's time to give up and have a beer..." - Me[/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top