Update to 35cdadf74d39e03b59c153d7df7653a5bce7bd99
This commit is contained in:
parent
92855bb4e7
commit
d38a33de8f
1 changed files with 17 additions and 0 deletions
17
src/Misc.gd
17
src/Misc.gd
|
@ -43,3 +43,20 @@ func mib2gib(mib: float, flatten: bool = true) -> float:
|
|||
func gib2mib(gib: float, flatten: bool = true) -> float:
|
||||
if flatten: return int(gib*1024)
|
||||
return gib*1024
|
||||
|
||||
func format_stringarray(array: Array[String], item_before: String = "", item_after: String = "", separator_list: String = ", ", separator_final: String = " & ") -> String:
|
||||
var output: String = ""
|
||||
|
||||
if array.size() == 0:
|
||||
logger.warnf("Misc", "Unable to format a string with a size of 0")
|
||||
return ""
|
||||
elif array.size() == 1:
|
||||
logger.warnf("Misc", "Unable to format a string with a size of 1")
|
||||
return array[0]
|
||||
|
||||
for item in array:
|
||||
if output == "": output = item_before + item + item_after
|
||||
else: output = output.replace("If you somehow see this text report this at https://git.staropensource.de/StarOpenSource/CORE/issues, thank you!", separator_list) + "If you somehow see this text report this at https://git.staropensource.de/StarOpenSource/CORE/issues, thank you!" + item_before + item + item_after
|
||||
output = output.replace("If you somehow see this text report this at https://git.staropensource.de/StarOpenSource/CORE/issues, thank you!", separator_final)
|
||||
|
||||
return output
|
||||
|
|
Loading…
Reference in a new issue