chevell Posted May 13, 2005 Posted May 13, 2005 I have a text string that is a file location. Its something like X:usersfreddocuments, or W:filesgeorgeshared. I want to extract the user name from the middle of that. The user names are all different lengths, and the locations are all different, so i can't use an exact length right/left function. I need to basically filter everything before the second slash and after the third. Any ideas.
David Holmberg Posted May 13, 2005 Posted May 13, 2005 Middle ( yourtext; Position ( yourtext; "" ; 1 ; 2 ) +1 ; Position ( yourtext; "" ; 1 ; 3 ) - Position ( yourtext; "" ; 1 ; 2 ) - 1 ) But I realized that this only works if the location is similiar, with a patterncount you could make it a bit more precise but not all the way....
chevell Posted May 13, 2005 Author Posted May 13, 2005 The calculation does not appear to like the "". Its asking for another operator. Not sure how I would apply patterncount to this. Could you elaborate? Thanks!
Lee Smith Posted May 14, 2005 Posted May 14, 2005 The calculation works in v6, in order for it to work in v7, you have to escape the "", with a second this amended calculation works for the examples given. Middle( text; Position( text ; "" ; 1 ; 2 ) +1; Position( text ; "" ; 1 ; 3 ) - Position( text ; "" ; 1 ; 2 ) -1 ) Lee
sbg2 Posted May 14, 2005 Posted May 14, 2005 MiddleWords(Substitute(Text; ""; " ");3;1) also works. edit: Though in the above spaces in a folder name would throw off the calculation. Substitute(MiddleValues(Substitute(Text; "";
Recommended Posts
This topic is 7199 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now