public static string StrExtract(string cSearchExpression, string cBeginDelim, string cEndDelim, int nBeginOccurence, int nFlags) { string cstring = cSearchExpression; string cb = cBeginDelim; string ce = cEndDelim; string lcRetVal = ""; if ((nFlags == 1)) { cstring = cstring.ToLower(); cb = cb.ToLower(); ce = ce.ToLower(); } // Lookup the position in the string int nbpos = VFPToolkit.strings.At(cb, cstring, nBeginOccurence); if ((cSearchExpression.Substring(nbpos, ce.length) != ce)) { int nepos = cstring.IndexOf(ce, (nbpos + 1)); // Extract the part of the strign if we get it right if ((nepos > nbpos)) { lcRetVal = cSearchExpression.Substring(nbpos, (nepos - nbpos)); } else if ((nepos < 1)) { lcRetVal = cSearchExpression.Substring(nbpos); } } return lcRetVal; }Glenn
~abc~def~~jkl~>>will return "~jkl" for StrExtract(lcString,"~'","~",3)