Results 1 to 7 of 7

Thread: enVar - simple module for handling of environment variables

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,156
    Rep Power
    736

    enVar - simple module for handling of environment variables

    In case you need to work with environment variables, you might be interested in module named enVar.

    It is provided with full source code, unit tests and binaries here:
    https://github.com/petrSchreiber/thinBasic_enVar

    How to use
    Get the DLL from latest release.

    Copy the DLL to your thinBasic/Mod directory, you should be able to reference it then like:
    Uses "EnVar"
    
    Example of the syntax:
        ' -- Sets value of MyVariable to MyValue
        enVar_Set "MyVariable", "MyValue" 
    
        ' -- Retrieves the value of given variable
        String s = enVar_Get "MyVariable" 
    
        ' -- Returns comma separated list of environment variables
        String s = enVar_List 
    
        ' -- Returns list of environment variables, separated by user specified string
        String s = enVar_List(";") 
    
        ' -- Erases the specified variable
        enVar_Remove "MyVariable"
    
        ' -- Returns non-zero value in case the variable does exist
        enVar_Exists "MyVariable"
    
        ' -- Set a variable with comma separated values
       envVar_Set "MyCars", "Tesla Model S,Ferrari 512GT"
    
       Long nCars = envVar_GetItemCount "MyCars" ' -- Presumes comma, returns 2
       nCars = envVar_GetItemCount "MyCars", "," ' -- Separator specified explicitly, returns 2
    
       String firstCar  = envVar_GetItem "MyCars", ",", 1 ' -- Returns "Tesla Model S"
       String secondCar = envVar_GetItem "MyCars", ",", 2 ' -- Returns "Ferrari 512GT"
    
    Let me know if you need anything to be added.


    Petr
    Last edited by Petr Schreiber; 12-03-2016 at 20:10.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Similar Threads

  1. IniFile - module for INI file handling
    By Petr Schreiber in forum Sources, Templates, Code Snippets, Tips and Tricks, Do you know ...
    Replies: 6
    Last Post: 18-03-2016, 21:21
  2. Organini - simple module for INI files
    By Petr Schreiber in forum Sources, Templates, Code Snippets, Tips and Tricks, Do you know ...
    Replies: 11
    Last Post: 04-05-2015, 05:41
  3. Simple Variables
    By Charles Pegge in forum O2h Compiler
    Replies: 0
    Last Post: 17-03-2009, 15:47
  4. File handling in TBGL module
    By ErosOlmi in forum TBGL General
    Replies: 3
    Last Post: 22-02-2007, 00:18
  5. Module data handling
    By ErosOlmi in forum Statistics Module
    Replies: 0
    Last Post: 07-09-2006, 10:52

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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