Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string GetLineByOffset(string text, int offset)
- {
- if (string.IsNullOrEmpty(text) || offset < 0 || offset > text.Length - 1)
- {
- return "";
- }
- var line = "";
- var i = offset;
- while (i <= (text.Length - 1) && text[i] != ('\r') && text[i] != '\n')
- {
- line = line + text[i];
- i += 1;
- }
- i = offset;
- line = line.Substring(1);
- while (i <= (text.Length - 1) && text[i] != ('\r') && text[i] != '\n')
- {
- line = text[i] + line;
- i -= 1;
- }
- return line;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement