ini-parser icon indicating copy to clipboard operation
ini-parser copied to clipboard

How ignoring special characters like hash # at reading or common?

Open Paderman opened this issue 2 years ago • 1 comments

How is it possible to ignore hash or other special characters at the beginning or common?

I have a non standard ini file that begins with a special character like # for comments, but with this character, I get an error message, without, it works.

Error message: IniParser.Exceptions.ParsingException: 'Unknown file format. Couldn't parse the line: '#'. while parsing line number 0 with value '' - IniParser version: 2.5.2.0 while parsing line number 1 with value '#' - IniParser version: 2.5.2.0'

Thank you for your solution and helping 🙂

Paderman avatar Nov 08 '22 05:11 Paderman

Well, you can use '#' for comments, e.g.

var parser = new FileIniDataParser();
parser.Parser.Configuration.CommentString = "#";

(That setting defaults to ';', by the way.)

Hope that helps, Jim

jacobussystems avatar Nov 08 '22 13:11 jacobussystems