Groups | Blog | Home
all groups > asp.net > february 2007 >

asp.net : InstrRev (VB) --> C# ???


Andrew
2/20/2007 11:57:27 PM
One year ago I have programmed in VB. There was a function named
"InStrRev".
In C# I don't have found a similar function. Can anybody help me in
this question.

Thanks a lot
regards
andrew
verci
2/21/2007 12:16:39 AM
Hi Andrew

You must reference the Microsoft.VisualBasic.dll in your project, or copy
the dll to the bin folder, for this function to be map, and use
Microsoft.VisualBasic.Strings.InStrRev.

Regards


[quoted text, click to view]

Andrew
2/21/2007 12:29:36 AM
Hi Verci

Thanks for your fast answer.
So, I was searching a similar function (like Instrrev in VB) in C#.

Two minute ago I have found what I searched.

The function in C# calls lastIndexOf()

Thanks

regards
David Anton
2/21/2007 8:00:34 AM
Just be aware that the VB InStrRev is 1-based and LastIndexOf (and all other
..NET methods) are 0-based, so adjust accordingly.
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
Instant Python: C#/VB to Python converter


[quoted text, click to view]
David Anton
2/21/2007 9:09:05 AM
Here's an example of the possible confusion that can occur due to the fact
that the VB function is 1-based:
InStrRev(a, b, c)
converts to the following in C#:
a.LastIndexOf(b, c - 1) + 1
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
Instant Python: C#/VB to Python converter


[quoted text, click to view]
AddThis Social Bookmark Button