dc

dc

  • NA
  • 663
  • 0

C# indexof problem

Oct 8 2012 6:13 PM
In a C# 2008 application, I am trying trying to obtain data about a file based upon the directory file where a file is located under. Basically I am trying to obtain a company name. The directory folder name is "Company Name(Company Number)". I would be do a substring to obtain the company name.

I have code like the following:

int intSTartNameloc = strFilename.IndexOf("(");
string strCompanyName = strFilename.substring(0,intSTartNameloc);

My problem is the intSTartNameloc is not picking up the real position of the left parantheseis. Thus can you tell me how to
change the line "int intSTartNameloc = strFilename.IndexOf("(");" so it selects the correct position?

Answers (1)