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
|
|
|
*/
|
2023-03-02 08:55:55 +00:00
|
|
|
module dlog.utilities;
|
|
|
|
|
2023-03-02 08:56:50 +00:00
|
|
|
import std.conv : to;
|
|
|
|
|
2023-03-02 08:55:55 +00:00
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
}
|