Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string SplitStartTags(string line, ref string pre)
- {
- var l = 0;
- var len = line.Length;
- // ssa tag
- for (var r = l; r < len; r++)
- {
- if (line[r] == '{' && r + 1 < len && line[r + 1] == '\\')
- {
- l = r;
- }
- else if (line[r] == '}' && line[l] == '{')
- {
- l = r + 1;
- }
- else if (line[l] != '{')
- {
- break;
- }
- }
- // html tags
- for (var r = l; r < len; r++)
- {
- if (line[r] == '<')
- {
- l = r;
- }
- else if (line[r] == '>' && line[l] == '<')
- {
- var tag = line.Substring(l, r - l + 1);
- if (knownTags.Contains(tag))
- {
- l = r + 1;
- }
- else
- {
- // stop in invalid tag
- break;
- }
- }
- else if (line[l] != '<')
- {
- break;
- }
- }
- pre = line.Substring(0, l);
- return line.Substring(l);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement