SPONSORS:






User Tag List

Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    Oct 1999
    Location
    Tyngsborough, MA
    Posts
    211
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    making a list of ini file sections

    Does anyone have a function to grab a list of all sections contained in an ini file?

    if not I'll be posting one when I'm done.

    ------------------
    Oops, meant to post this in the Silk forum.


    [This message has been edited by BrianCarroll (edited 08-06-2001).]

  2. #2
    Senior Member
    Join Date
    Dec 2000
    Location
    Portland, OR
    Posts
    403
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: making a list of ini file sections

    You should be able to do that rather easily using a bit of Perl.

    Match any line that looks like
    [***]

    I think the proper regex might look like

    /^[(.*)]$/
    with the text in $1.

    Silk does regex's but it is not as robust as Perl.

    good luck.


    ------------------
    It Depends.

  3. #3
    Member
    Join Date
    Jun 2001
    Location
    Bedford, MA, USA
    Posts
    85
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: making a list of ini file sections

    Here is a function that will work on any test file that has [bracketed] sections.
    Hope this helps.
    - Jim

    (For some !@#*$ reason I am DENIED permission to upload a file that contains this function!!!)

    --------------------------------
    LIST OF STRING GetListOfSections(STRING sFile)
    STRING sLine=""
    LIST OF STRING lsFileContents={}
    LIST OF STRING lsSections={}

    ListRead(lsFileContents, sFile)

    for each sLine in lsFileContents
    sLine = LTrim(sLine) // strip leading spaces
    // skip comment lines
    if MatchStr(";*",sLine) | | MatchStr ("//*",sLine)
    continue // skip it

    if MatchStr("<LI>",sLine)
    // found a section heading?
    sLine = StrTran(sLine,"[","")
    // strip right bracket & anything after it
    sLine = Left(sLine, StrPos("]",sLine)-1)
    // add section name to our list
    ListAppend(lsSections,sLine)
    return lsSections


    ------------------

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 07:44 AM.

Copyright BetaSoft Inc.