ATcommand in .NET

  • Thread starter Thread starter smeagol
  • Start date Start date
S

smeagol

Some xBase languages have a command called AT (remember this?)

In C# this might look like

int retPosition = AT(searchedString, InString);

in xBase
dd = AT("DD", MASK)

It return the position in "dd" searching into "MASK" the "DD" string.

I was looking in the help, but i was unable to find it.

Some help?
 
I believe you are looking for string.IndexOf().

string s = "shane";
int pos = s.IndexOf("ha");

ShaneB
 
If I understand what you are asking for correctly, you want to know
where in the text string that the second string occurs. In .Net it is
built into the string objects to do this using the IndexOf method. For
example:

string name = "John";
int position = name.IndexOf("oh");
//position will have the value 1 as the o is in the second position in
the string

Hope that is what you were looking for.

Have A Better One!

John M Deal, MCP
Necessity Software
 
smeagol wrote:

It return the position in "dd" searching into "MASK" the "DD" string.


try the IndexOf() method of the string class, I think that will do what
you want.

Cheers Tim.
 
Back
Top