0

Hi,

Reverentjim kindly gave me this code the other day that worked well. There are two more things i am trying to do but cant get my head around it.

1) I want to be able to extract the text after the second \ and before the period
e.g. profile

2) if exists, I want to change the text to lower after the period

e.g. domain

TIA

dim str as String = "C:\Users\profile.DOMAIN"str = str.Substring(0, 1).ToLower & str.Substring(1)
6
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by Reverend Jim
0

Hey, you could use something like this:

Dim path as string = "C:\Users\profile.DOMAIN"
Dim Str as string() = path.substring(path.lastidexof("\")+1).split(".")

with that you get Str with 2 values, the first one Str(0) should be profile, the second one Str(1) DOMAIN, now just use them as you please.

0

My.Computer.FileSystem.GetName(filename)

Returns just the filename portion of the fully qualified file.

My.Computer.FileSystem.GetParentPath(filename)

Returns the path portion. For filename = "C:\Users\profile.DOMAIN", the first returns

profile.DOMAIN

and the second returns

C:\Users

Edited by Reverend Jim: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.