At the moment I am trying to parse this simple file
At the moment I am trying to parse this simple file
home = C:\Program Files (x86)\Python\35
include-system-site-packages = true
version = 3.5.0
I want to read out the value named include-system-site-packages
At first I thought that I could load it into a string list, and read Values['include-system-site-packages']. That fails because of the trailing space after include-system-site-packages.
The I thought I could use a TMemIniFile, but that fails too because the file does not contain any sections.
Is there any other simple built in class that can get this job done or should I hold my nose and parse the file myself?
home = C:\Program Files (x86)\Python\35
include-system-site-packages = true
version = 3.5.0
I want to read out the value named include-system-site-packages
At first I thought that I could load it into a string list, and read Values['include-system-site-packages']. That fails because of the trailing space after include-system-site-packages.
The I thought I could use a TMemIniFile, but that fails too because the file does not contain any sections.
Is there any other simple built in class that can get this job done or should I hold my nose and parse the file myself?
I wasn't really asking for ideas on how to do it manually. Obviously I can do that readily enough. I was just mostly wondering if there was a concise way to do it with built in library functionality.
ReplyDeleteI guess the TMemIniFile approach with an injected section might be the nearest you can get with the classes that comes with Delphi.
ReplyDeleteAs this thread shows, and I can't come up with a better alternative than Uwe's - there doesn't seem to be a ready to use lib func.
ReplyDeleteI'd probably just Pos the '=', then copy out and trim the pre-part, and likewise for the post-part. Brute force, sort of.