CAESDO.Recruitment.TemplateProcessing.HandleBody C# (CSharp) Метод

HandleBody() приватный Метод

Iterates through the given template file and replaces any place where there is a template field marked with {}
private HandleBody ( string body ) : string
body string The template text.
Результат string
        private string HandleBody(string body)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<html><body>");

            string parameter;

            int begindex = body.IndexOf("{"); // Find the beginning of a replacement string
            int endindex;
            while (begindex > 0)
            {
                sb.Append(body.Substring(0, begindex)); // Copy the text that comes before the replacement string to temp
                body = body.Substring(begindex);        // Removes the first part of the string before the {

                endindex = body.IndexOf("}"); // Find the end of a replacement string

                parameter = body.Substring(0, endindex + 1);   // Pulls the text between {}
                body = body.Substring(endindex + 1);    // removes the parameter substring

                sb.Append(this.replaceParameter(parameter));

                begindex = body.IndexOf("{"); // Find the beginning of a replacement string
            }

            sb.Append(body);
            sb.Append("</body></html>");

            return sb.ToString();
        }