Пример #1
0
        /// <summary>
        /// 현재 문장을 감싼 p 태그가 하나 뿐이라면 삭제함.
        /// </summary>
        /// <param name="Value"></param>
        /// <returns></returns>
        public static string TrimPTagIfOne(string Value)
        {
            string ValueNew = Value.Trim();

            if (ValueNew.StartsWith("<p>", StringComparison.CurrentCultureIgnoreCase) &&
                ValueNew.EndsWith("</p>", StringComparison.CurrentCultureIgnoreCase) &&
                (ValueNew.IndexOf("<p>", 3, StringComparison.CurrentCultureIgnoreCase) == -1)
                )
            {
                ValueNew = CFindRep.SubstringFromTo(ValueNew, "<p>".Length, ValueNew.Length - ("</p>".Length + 1));
                return(ValueNew);
            }

            return(Value);
        }
Пример #2
0
        public static string FindVariable(string ValueHasVar, string DelimStart, string DelimEnd, int StartIndex, out int StartIndexNextIs)
        {
            StartIndexNextIs = -1;

            int PosStart = ValueHasVar.IndexOf(DelimStart, StartIndex);

            if (PosStart == -1)
            {
                return("");
            }
            PosStart += DelimStart.Length;

            int PosEnd = ValueHasVar.IndexOf(DelimEnd, (PosStart + 1));

            if (PosEnd == -1)
            {
                return("");
            }
            PosEnd--;

            StartIndexNextIs = (PosEnd + 1 + DelimEnd.Length);

            return(CFindRep.SubstringFromTo(ValueHasVar, PosStart, PosEnd));
        }