momand Posted August 10, 2004 Posted August 10, 2004 I'm attempting to use StringSplit on a line such as "z:\\TMG93\techelp\H22562", however I need to be able to split the string after the \\ and the first \. I've tried the command $drives = StringSplit($line, "\\\"), but it splits the string exactly the same as $drives = StringSplit($line, "\\"). Is there any way of specifying multiple delimiters in a case such as this? Thanks.! michael.omand@sunlife.com
CyberSlug Posted August 10, 2004 Posted August 10, 2004 (edited) StringSplit supports multiple single-char delimiters, but it does not support multi-char delimiters..... (The help file remarks and example for StringSplit should make some mention of this, but it's easy to overlook)You would need to first replace the "\\" with a single character such as * or ? or | or any other character guarranteed to not appear in a file name.$line = StringReplace("z:\\TMG93\techelp\H22562", "\\", "?") $drives = StringSplit($line, "\?");multiple single-char separatorsor you could combine the StringReplace and StringSplitand I think you could simply replace \\ with \$drives = StringSplit(StringReplace("z:\\TMG93\techelp\H22562", "\\", "\"), "\") Edited August 10, 2004 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Developers Jos Posted August 10, 2004 Developers Posted August 10, 2004 You could do it this way $I = "z:\\TMG93\techelp\H22562" $S = StringTrimLeft($I,StringInStr($i,"\\")+1) $S = StringLeft($S,StringInStr($s,"\")-1) MsgBox(0,"demo",$s) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Recommended Posts
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