|
|
|
@ -317,10 +317,39 @@ public final function bool IsEmpty(BaseText text)
|
|
|
|
|
public final function string IntoString(/*take*/ BaseText toConvert) |
|
|
|
|
{ |
|
|
|
|
local string result; |
|
|
|
|
|
|
|
|
|
if (toConvert != none) { |
|
|
|
|
result = toConvert.ToString(); |
|
|
|
|
_.memory.Free(toConvert); |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Converts given array of `BaseText`s into an array of plain `string`s, |
|
|
|
|
* returning their values and deallocating passed `BaseText`. |
|
|
|
|
* |
|
|
|
|
* Method introduced to simplify a common use-case of converting returned |
|
|
|
|
* copies of `BaseText`s into a `string`s, which required additional variable |
|
|
|
|
* to store and later deallocate `BaseText` references. |
|
|
|
|
* |
|
|
|
|
* @param toConvert Array of `BaseText`s to convert. |
|
|
|
|
* @return Array of `string`s, representing passed `BaseText`s as |
|
|
|
|
* a plain string. |
|
|
|
|
* Empty `string`, if `toConvert == none`. |
|
|
|
|
*/ |
|
|
|
|
public final function array<string> IntoStrings(/*take*/ array<BaseText> toConvert) { |
|
|
|
|
local int i; |
|
|
|
|
local array<string> result; |
|
|
|
|
|
|
|
|
|
for (i = 0; i < toConvert.length; i += 1) { |
|
|
|
|
if (toConvert[i] != none) { |
|
|
|
|
result[result.length] = toConvert[i].ToString(); |
|
|
|
|
_.memory.Free(toConvert[i]); |
|
|
|
|
} else { |
|
|
|
|
result[result.length] = ""; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
_.memory.Free(toConvert); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -346,6 +375,34 @@ public final function string IntoColoredString(/*take*/ BaseText toConvert)
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Converts given array of `BaseText`s into an array of colored `string`s, |
|
|
|
|
* returning their values and deallocating passed `BaseText`. |
|
|
|
|
* |
|
|
|
|
* Method introduced to simplify a common use-case of converting returned |
|
|
|
|
* copies of `BaseText`s into a `string`s, which required additional variable |
|
|
|
|
* to store and later deallocate `BaseText` references. |
|
|
|
|
* |
|
|
|
|
* @param toConvert Array of `BaseText`s to convert. |
|
|
|
|
* @return Array of `string`s, representing passed `BaseText`s as |
|
|
|
|
* a colored string. |
|
|
|
|
* Empty `string`, if `toConvert == none`. |
|
|
|
|
*/ |
|
|
|
|
public final function array<string> IntoColoredStrings(/*take*/ array<BaseText> toConvert) { |
|
|
|
|
local int i; |
|
|
|
|
local array<string> result; |
|
|
|
|
|
|
|
|
|
for (i = 0; i < toConvert.length; i += 1) { |
|
|
|
|
if (toConvert[i] != none) { |
|
|
|
|
result[result.length] = toConvert[i].ToColoredString(); |
|
|
|
|
_.memory.Free(toConvert[i]); |
|
|
|
|
} else { |
|
|
|
|
result[result.length] = ""; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Converts given `BaseText` into a formatted `string`, returns it's value and |
|
|
|
|
* deallocates passed `BaseText`. |
|
|
|
@ -368,6 +425,34 @@ public final function string IntoFormattedString(/*take*/ BaseText toConvert)
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Converts given array of `BaseText`s into an array of formatted `string`s, |
|
|
|
|
* returning their values and deallocating passed `BaseText`. |
|
|
|
|
* |
|
|
|
|
* Method introduced to simplify a common use-case of converting returned |
|
|
|
|
* copies of `BaseText`s into a `string`s, which required additional variable |
|
|
|
|
* to store and later deallocate `BaseText` references. |
|
|
|
|
* |
|
|
|
|
* @param toConvert Array of `BaseText`s to convert. |
|
|
|
|
* @return Array of `string`s, representing passed `BaseText`s as |
|
|
|
|
* a formatted string. |
|
|
|
|
* Empty `string`, if `toConvert == none`. |
|
|
|
|
*/ |
|
|
|
|
public final function array<string> IntoFormattedStrings(/*take*/ array<BaseText> toConvert) { |
|
|
|
|
local int i; |
|
|
|
|
local array<string> result; |
|
|
|
|
|
|
|
|
|
for (i = 0; i < toConvert.length; i += 1) { |
|
|
|
|
if (toConvert[i] != none) { |
|
|
|
|
result[result.length] = toConvert[i].ToFormattedString(); |
|
|
|
|
_.memory.Free(toConvert[i]); |
|
|
|
|
} else { |
|
|
|
|
result[result.length] = ""; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Creates a `string` that consists only of a given character. |
|
|
|
|
* |
|
|
|
|