Skip to content
Snippets Groups Projects
Commit 97569d7b authored by leprob001's avatar leprob001
Browse files

tomlini.m now skips empty lines.

parent acec9c48
No related branches found
No related tags found
No related merge requests found
......@@ -78,7 +78,7 @@ fileContent = fileread(pFilename);
allSections = splitIntoSections(fileContent);
for i = 1:length(allSections)
if (isComment(allSections{i})) % ignore the line
if (isempty(allSections{i}) || isComment(allSections{i})) % ignore the line
continue;
end
[title, content] = extractTitleAndContent(allSections(i));
......@@ -135,6 +135,10 @@ end
function [ isComment ] = isComment(pLine)
trimmedLine = strtrim(pLine);
if (isempty(trimmedLine))
isComment = true;
return;
end
if (trimmedLine(1) == reservedCharacters.comment)
isComment = true;
else
......@@ -146,7 +150,7 @@ end
lines = splitlines(pContent);
returnContent = struct();
for i = 1:length(lines)
if (isComment(lines{i}) || isempty(lines{i}))
if (isempty(lines{i}) || isComment(lines{i}))
continue
end
[line, comment] = extractValueAndComment(lines{i});
......@@ -176,7 +180,7 @@ end
%matrix = [];
columnCount = 0;
for i = 1:length(lines)
if (isComment(lines{i}) || isempty(lines{i}))
if (isempty(lines{i}) || isComment(lines{i}))
continue
end
% cut rest of line if a comment character is available
......@@ -209,7 +213,7 @@ end
lines = splitlines(pContent);
cell = {};
for i = 1:length(lines)
if (isComment(lines{i}) || isempty(lines{i}))
if (isempty(lines{i}) || isComment(lines{i}))
continue
end
[line, comment] = extractValueAndComment(lines{i});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment