comp.lang.ada
 help / color / mirror / Atom feed
From: Victor Porton <porton@narod.ru>
Subject: Simple string template formatter (Dmitry A. Kazakov take note)
Date: Wed, 22 Nov 2017 22:23:51 +0200
Date: 2017-11-22T22:23:51+02:00	[thread overview]
Message-ID: <ov4mcm$fn2$1@gioia.aioe.org> (raw)

I created a simple string template formatter (no if-then-else, no include, 
just substitution of variables).

Example:

"First phrase: {1}. Second phrase: {2}."

This formatter is suitable for short strings, such as phrases for gettext.

https://github.com/vporton/xml-boiler/blob/master/src/boiler-auxiliary-string_formatter.ads
https://github.com/vporton/xml-boiler/blob/master/src/boiler-auxiliary-string_formatter.adb

My code was not tested!

Dmitry, I ask you to add something like this to your Simple Components.

My program anyway uses Simple Components, so after you implement it, I can 
remove these files from my sources.

I released the files in question both GPLv3 and Apache License 2.0. So feel 
free to use it as a coding example.

-- 
Victor Porton - http://portonvictor.org

             reply	other threads:[~2017-11-22 20:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22 20:23 Victor Porton [this message]
2017-11-22 20:44 ` Simple string template formatter (Dmitry A. Kazakov take note) Victor Porton
2017-11-22 22:26 ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox