Function lineDelta [src]

Prototype

pub fn lineDelta(source: []const u8, start: usize, end: usize) isize

Parameters

source: []const u8start: usizeend: usize

Source

pub fn lineDelta(source: []const u8, start: usize, end: usize) isize { var line: isize = 0; if (end >= start) { for (source[start..end]) |byte| switch (byte) { '\n' => line += 1, else => continue, }; } else { for (source[end..start]) |byte| switch (byte) { '\n' => line -= 1, else => continue, }; } return line; }