Back to problems

Environment Variable String Substitution

Algorithm · Amazon · Medium

Build a lightweight store for environment variables together with a parser that performs placeholder substitution on strings. The store keeps a mapping from variable names to string values. A template may reference a variable by wrapping its name in percent signs, as in %KEY%; parsing the template swaps each such reference for the value currently stored under that name. Your implementation must expose these three operations: Usage sketch: For testing from the command line,…

Loading the rest of the question…