Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String function to find a given substring in C#
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01294756
Message ID:
01294765
Views:
12
If you remember the function in VFP and don't know quite how to do it in C#, I recommend downloading the VFP ToolKit for .NET (http://foxcentral.net/microsoft/VFPToolkitNET.htm). Keep in mind the toolkit was written in .NET 1.1 and does not utilize all the new features.

In your case IndexOf or LastIndexOf should help you.

>All,
>
>I have a string and I need to find out at what position in the string a certain value exists. I need to do this in C#. For example:
>
>myString = '123456789Trade=xxxxxx'
>
>I want to interrogate the myString value and determine at what position does "Trade=" start. In this case I need to return the value 10 (or maybe 9 if the 1st position is the 0th position) as this would be the 10th (or 9th) position. I expect this constant value to exist in the string but will be in different positions in a file I am reading.
>
>Please advise as to what method or function I can use for this.
>
>Thanks in advance.
Semper ubi sub ubi.
Previous
Reply
Map
View

Click here to load this message in the networking platform