dlog/source/dlog/utilities.d

30 lines
606 B
D
Raw Permalink Normal View History

2023-03-03 13:30:43 +00:00
/**
* Helper functions
2024-04-09 17:56:33 +01:00
*
* Authors: Tristan Brice Velloza Kildaire (deavmi)
2023-03-03 13:30:43 +00:00
*/
module dlog.utilities;
import std.conv : to;
/**
* Given an arbitrary amount of arguments, convert each to a string
* and return that as an array
*
* Params:
* segments = alias sequence
* Returns: a flattened string[]
*/
public string[] flatten(TextType...)(TextType segments)
{
/* The flattened components */
string[] components;
/* Flatten the components */
static foreach(messageComponent; segments)
{
components ~= to!(string)(messageComponent);
}
return components;
}