function AddBs_E(tcString) return iif(right(m.tcString,1)=="\", m.tcString, m.tcString+"\") function JustDrive_E(tcString) return iif (substr(m.tcString,2,1)==":", left(m.tcString, 2), "") function JustPath_E(tcString) local lnLAstSlash lnLAstSlash = max(rat("/",m.tcString), rat("\",m.tcString)) function JustFName_E(tcString) local lnDivider lnDivider = max(rat("/",m.tcString), rat("\",m.tcString)) do case case m.lnDivider=1 RETURN JustFName_E_DoubDot(m.tcString) case m.lnDivider>1 return substr(m.tcString,m.lnDivider+1) otherwise RETURN JustFName_E_DoubDot(m.tcString) endcase function JustFName_E_DoubDot(tcString) if substr(m.tcString, 2, 1) ==":" if len(m.tcString)>2 RETURN substr(m.tcString, 3) else return "" endif else return m.tcString endif function JustStem_E(tcString) local lcFNAme, lnLastDot lcFNAme = JustFName_E(m.tcString) lnLastDot = rat(".", m.lcFNAme) return iif(m.lnLastDot=0, m.lcFNAme, left(m.lcFNAme, m.lnLastDot-1)) function JustExt_E(tcString) local lcFNAme, lnLastDot lcFNAme = JustFName_E(m.tcString) lnLastDot = rat(".", m.lcFNAme) return iif(m.lnLastDot=0 or m.lnLastDot=len(m.lcFNAme), "", substr(m.lcFNAme, m.lnLastDot+1))>Hi Samuel,
clea >= JustLine("Hallo\Pa\Nex\men.34", "DOS Separators") >= JustLine("Hallo/Pa/Nex/men.34", "DOS Separators") >= JustLine("Hallo/Pa\Nex/men.34", "DOS and Unix Separators") >= JustLine("Hallo/Pa\.\\..//../Nex/men.34", "Dots, DOS and Unix Separators") >= JustLine("Hallo/Pa\Nex/men.34/", "Trailing Unix Separator") >= JustLine("Hallo/Pa\Nex/men.34\", "Trailing DOS Separator") >= JustLine("Hallo/Pa\Nex/me:n.34", ": put into Stem") >= JustLine("Hallo/Pa\Nex/me:n.3:4", ": put into Stem and Ext") >= JustLine("C://Hallo/Pa\Nex/me:n.3:4", ": put into Stem and Ext") >= JustLine("C:\Hallo/Pa\Nex/me:n.3:4", "JustDrive Test and : put into Stem and Ext") >= JustLine("C:me:n.3:4", "No Slash: Path NOT filled") >= JustLine(":me:n.3:4", "Drive and Path NOT filled") >= JustLine("::me:n.3:4", "Drive filled and Path NOT filled") >= JustLine("/:me:n.3:4", "Drive filled and Path NOT filled") >= JustLine("\:me:n.3:4", "Drive filled and Path NOT filled") >= JustLine(":\me:n.3:4", "Drive not filled and Path NOT filled") >= JustLine(":\me:n.3:4.", "Drive not filled and Path NOT filled") >= JustLine("Hydra://Hallo/Pa\Nex/me:n.3:4", ": put into Stem and Ext") > > >function JustLine(tcTest, tcComment) > do case > case !addbs(m.tcTest) == AddBs_E(m.tcTest) > = JustShowAll(m.tcTest, "Failed AddBs " + m.tcComment) > ? AddBs_E(m.tcTest) > case !justdrive(m.tcTest) == JustDrive_E(m.tcTest) > = JustShowAll(m.tcTest, "Failed JustDrive " + m.tcComment) > ? JustDrive_E(m.tcTest) > case !justpath(m.tcTest) == JustPath_E(m.tcTest) > = JustShowAll(m.tcTest, "Failed JustPath " + m.tcComment) > ? JustPath_E(m.tcTest) > case !justfname(m.tcTest) == JustFName_E(m.tcTest) > set step on > = JustShowAll(m.tcTest, "Failed JustFName " + m.tcComment) > ? JustFName_E(m.tcTest) > case !juststem(m.tcTest) == JustStem_E(m.tcTest) > = JustShowAll(m.tcTest, "Failed JustStem " + m.tcComment) > ? JustStem_E(m.tcTest) > case !justext(m.tcTest) == JustExt_E(m.tcTest) > = JustShowAll(m.tcTest, "Failed JustExt " + m.tcComment) > ? JustExt_E(m.tcTest) > otherwise > ? "Ok" , m.tcComment > * = JustShowAll(m.tcTest, "ok " + m.tcComment) > endcase > >function JustShowAll(tcTest, tcComment) > ? > ? tcTest > ? tcComment > ? "Drive:", justdrive(m.tcTest) > ? "PAth :", justpath(m.tcTest) > ? "FNAme:", justfname(m.tcTest) > ? "Stem :", juststem(m.tcTest) > ? "Ext :", justext(m.tcTest) > >function AddBs_E(tcString) > return iif(right(m.tcString,1)=="\", m.tcString, m.tcString+"\") > >function JustDrive_E(tcString) > return iif (substr(m.tcString,2,1)==":", left(m.tcString, 2), "") > >function JustPath_E(tcString) > local lnLAstSlash > lnLAstSlash = max(rat("/",m.tcString), rat("\",m.tcString)) > return icase( m.lnLAstSlash=0, ""; > , m.lnLAstSlash=1, left(m.tcString, 1); > , left(m.tcString, lnLAstSlash-1)) > >function JustFName_E(tcString) > local lnDivider > lnDivider = max(rat("/",m.tcString), rat("\",m.tcString)) > do case > case m.lnDivider=1 > RETURN JustFName_E_DoubDot(m.tcString) > case m.lnDivider>1 > return substr(m.tcString,m.lnDivider+1) > otherwise > RETURN JustFName_E_DoubDot(m.tcString) > endcase > >function JustFName_E_DoubDot(tcString) > if substr(m.tcString, 2, 1) ==":" > if len(m.tcString)>2 > RETURN substr(m.tcString, 3) > else > return "" > endif > else > return m.tcString > endif > >function JustStem_E(tcString) > local lcFNAme, lnLastDot > lcFNAme = JustFName_E(m.tcString) > lnLastDot = rat(".", m.lcFNAme) > return iif(m.lnLastDot=0, m.lcFNAme, left(m.lcFNAme, m.lnLastDot-1)) > >function JustExt_E(tcString) > local lcFNAme, lnLastDot > lcFNAme = JustFName_E(m.tcString) > lnLastDot = rat(".", m.lcFNAme) > return iif(m.lnLastDot=0 or m.lnLastDot=len(m.lcFNAme), "", subst(m.lcFNAme, m.lnLastDot+1))