Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Help with exact string match

Posted on 2007-04-06
2
Medium Priority
?
213 Views
Last Modified: 2013-11-07
I'm looping through the folder appA and all of its subfolders.  Some of the folders are:

c:\dev\myapps\appA\bin\release
c:\dev\myapps\appA\source
c:\dev\myapps\appA\bin\debug
c:\dev\myapps\appA\obj\appAUI
c:\dev\myapps\appA\obj\appAUI\TempPE

I set a variable that will be used as a relative path for the appA folder
Root = "appA"

Inside the loop, I may be on this folder:
paramDirectoryPath = "c:\dev\myapps\appA\obj"

and I create the relative path on each iteration this way:

paramDirectoryPath.LastIndexOf(string.Concat("\\", Root))
which gives
"\appA\obj"

It creates a relative root path for all subfolders in the appA folder.

I run into a problem when
paramDirectoryPath = "c:\dev\myapps\appA\obj\appAUI"

The LastIndexOf() code will give
"appAUI" instead of "appA".

I need to somehow get an exact, case insensitive match.  IndexOf() doesn't do this.  What is a way that I can get around that?
0
Comment
Question by:brettr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 18868054
paramDirectoryPath.ToUpper().IndexOf( string.Concat("\\", Root).ToUpper())
0
 

Author Comment

by:brettr
ID: 18868125
Thanks.  I actually ended up restructuring how this works but that's not your fault.  :)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question