brettr
asked on
Help with exact string match
I'm looping through the folder appA and all of its subfolders. Some of the folders are:
c:\dev\myapps\appA\bin\rel ease
c:\dev\myapps\appA\source
c:\dev\myapps\appA\bin\deb ug
c:\dev\myapps\appA\obj\app AUI
c:\dev\myapps\appA\obj\app AUI\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.LastInd exOf(strin g.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\ap pAUI"
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?
c:\dev\myapps\appA\bin\rel
c:\dev\myapps\appA\source
c:\dev\myapps\appA\bin\deb
c:\dev\myapps\appA\obj\app
c:\dev\myapps\appA\obj\app
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.LastInd
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\ap
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER