unreal.TextLibrary

class unreal.TextLibrary(outer=None, name='None')

Bases: unreal.BlueprintFunctionLibrary

Kismet Text Library

C++ Source:

  • Module: Engine

  • File: KismetTextLibrary.h

classmethod as_currency_base(base_value, currency_code)Text

Generate an FText that represents the passed number as currency in the current culture. BaseVal is specified in the smallest fractional value of the currency and will be converted for formatting according to the selected culture. Keep in mind the CurrencyCode is completely independent of the culture it’s displayed in (and they do not imply one another). For example: FText::AsCurrencyBase(650, TEXT(“EUR”)); would return an FText of “<EUR>6.50” in most English cultures (en_US/en_UK) and “6,50<EUR>” in Spanish (es_ES) (where <EUR> is U+20AC)

Parameters
  • base_value (int32) –

  • currency_code (str) –

Returns

Return type

Text

classmethod as_currency_float(value, rounding_mode, always_sign=False, use_grouping=True, minimum_integral_digits=1, maximum_integral_digits=324, minimum_fractional_digits=0, maximum_fractional_digits=3, currency_code='')Text

Converts a passed in float to a text formatted as a currency

Parameters
  • value (float) –

  • rounding_mode (RoundingMode) –

  • always_sign (bool) –

  • use_grouping (bool) –

  • minimum_integral_digits (int32) –

  • maximum_integral_digits (int32) –

  • minimum_fractional_digits (int32) –

  • maximum_fractional_digits (int32) –

  • currency_code (str) –

Returns

Return type

Text

classmethod as_currency_integer(value, rounding_mode, always_sign=False, use_grouping=True, minimum_integral_digits=1, maximum_integral_digits=324, minimum_fractional_digits=0, maximum_fractional_digits=3, currency_code='')Text

Converts a passed in integer to a text formatted as a currency

Parameters
  • value (int32) –

  • rounding_mode (RoundingMode) –

  • always_sign (bool) –

  • use_grouping (bool) –

  • minimum_integral_digits (int32) –

  • maximum_integral_digits (int32) –

  • minimum_fractional_digits (int32) –

  • maximum_fractional_digits (int32) –

  • currency_code (str) –

Returns

Return type

Text

classmethod as_date_date_time(date_time)Text

Converts a passed in date & time to a text, formatted as a date using an invariant timezone. This will use the given date & time as-is, so it’s assumed to already be in the correct timezone.

Parameters

date_time (DateTime) –

Returns

Return type

Text

classmethod as_date_time_date_time(in_)Text

Converts a passed in date & time to a text, formatted as a date & time using an invariant timezone. This will use the given date & time as-is, so it’s assumed to already be in the correct timezone.

Parameters

in (DateTime) –

Returns

Return type

Text

classmethod as_percent_float(value, rounding_mode, always_sign=False, use_grouping=True, minimum_integral_digits=1, maximum_integral_digits=324, minimum_fractional_digits=0, maximum_fractional_digits=3)Text

Converts a passed in float to a text, formatted as a percent

Parameters
  • value (float) –

  • rounding_mode (RoundingMode) –

  • always_sign (bool) –

  • use_grouping (bool) –

  • minimum_integral_digits (int32) –

  • maximum_integral_digits (int32) –

  • minimum_fractional_digits (int32) –

  • maximum_fractional_digits (int32) –

Returns

Return type

Text

classmethod as_time_date_time(in_)Text

Converts a passed in date & time to a text, formatted as a time using an invariant timezone. This will use the given date & time as-is, so it’s assumed to already be in the correct timezone.

Parameters

in (DateTime) –

Returns

Return type

Text

classmethod as_time_zone_date_date_time(date_time, time_zone='')Text

Converts a passed in date & time to a text, formatted as a date using the given timezone (default is the local timezone). This will convert the given date & time from UTC to the given timezone (taking into account DST).

Parameters
Returns

Return type

Text

classmethod as_time_zone_date_time_date_time(date_time, time_zone='')Text

Converts a passed in date & time to a text, formatted as a date & time using the given timezone (default is the local timezone). This will convert the given date & time from UTC to the given timezone (taking into account DST).

Parameters
Returns

Return type

Text

classmethod as_time_zone_time_date_time(date_time, time_zone='')Text

Converts a passed in date & time to a text, formatted as a time using the given timezone (default is the local timezone). This will convert the given date & time from UTC to the given timezone (taking into account DST).

Parameters
Returns

Return type

Text

classmethod as_timespan_timespan(timespan)Text

Converts a passed in time span to a text, formatted as a time span

Parameters

timespan (Timespan) –

Returns

Return type

Text

classmethod conv_bool_to_text(bool)Text

Converts a boolean value to formatted text, either ‘true’ or ‘false’

Parameters

bool (bool) –

Returns

Return type

Text

classmethod conv_byte_to_text(value)Text

Converts a byte value to formatted text

Parameters

value (uint8) –

Returns

Return type

Text

classmethod conv_color_to_text(color)Text

Converts a linear color value to localized formatted text, in the form ‘(R=,G=,B=,A=)’

Parameters

color (LinearColor) –

Returns

Return type

Text

classmethod conv_float_to_text(value, rounding_mode, always_sign=False, use_grouping=True, minimum_integral_digits=1, maximum_integral_digits=324, minimum_fractional_digits=0, maximum_fractional_digits=3)Text

Converts a passed in float to text based on formatting options

Parameters
  • value (float) –

  • rounding_mode (RoundingMode) –

  • always_sign (bool) –

  • use_grouping (bool) –

  • minimum_integral_digits (int32) –

  • maximum_integral_digits (int32) –

  • minimum_fractional_digits (int32) –

  • maximum_fractional_digits (int32) –

Returns

Return type

Text

classmethod conv_int64_to_text(value, always_sign=False, use_grouping=True, minimum_integral_digits=1, maximum_integral_digits=324)Text

Converts a passed in integer to text based on formatting options

Parameters
  • value (int64) –

  • always_sign (bool) –

  • use_grouping (bool) –

  • minimum_integral_digits (int32) –

  • maximum_integral_digits (int32) –

Returns

Return type

Text

classmethod conv_int_to_text(value, always_sign=False, use_grouping=True, minimum_integral_digits=1, maximum_integral_digits=324)Text

Converts a passed in integer to text based on formatting options

Parameters
  • value (int32) –

  • always_sign (bool) –

  • use_grouping (bool) –

  • minimum_integral_digits (int32) –

  • maximum_integral_digits (int32) –

Returns

Return type

Text

classmethod conv_name_to_text(name)Text

Converts Name to culture invariant text

Parameters

name (Name) –

Returns

Return type

Text

classmethod conv_object_to_text(obj)Text

Converts a UObject value to culture invariant text by calling the object’s GetName method

Parameters

obj (Object) –

Returns

Return type

Text

classmethod conv_rotator_to_text(rot)Text

Converts a rotator value to localized formatted text, in the form ‘P= Y= R=’

Parameters

rot (Rotator) –

Returns

Return type

Text

classmethod conv_string_to_text(string)Text

Converts string to culture invariant text. Use Format or Make Literal Text to create localizable text

Parameters

string (str) –

Returns

Return type

Text

classmethod conv_text_to_string(text)str

Converts localizable text to the string

Parameters

text (Text) –

Returns

Return type

str

classmethod conv_transform_to_text(trans)Text

Converts a transform value to localized formatted text, in the form ‘Translation: X= Y= Z= Rotation: P= Y= R= Scale: X= Y= Z=’

Parameters

trans (Transform) –

Returns

Return type

Text

classmethod conv_vector2d_to_text(vec)Text

Converts a vector2d value to localized formatted text, in the form ‘X= Y=’

Parameters

vec (Vector2D) –

Returns

Return type

Text

classmethod conv_vector_to_text(vec)Text

Converts a vector value to localized formatted text, in the form ‘X= Y= Z=’

Parameters

vec (Vector) –

Returns

Return type

Text

classmethod equal_equal_ignore_case_text_text(a, b)bool

Returns true if A and B are linguistically equal (A == B), ignoring case.

Parameters
Returns

Return type

bool

classmethod equal_equal_text_text(a, b)bool

Returns true if A and B are linguistically equal (A == B).

Parameters
Returns

Return type

bool

classmethod find_text_in_localization_table(namespace, key)Text or None

Attempts to find existing Text using the representation found in the loc tables for the specified namespace and key.

Parameters
  • namespace (str) –

  • key (str) –

Returns

out_text (Text):

Return type

Text or None

classmethod get_empty_text()Text

Returns an empty piece of text.

Returns

Return type

Text

classmethod is_polyglot_data_valid(polyglot_data) -> (is_valid=bool, error_message=Text)

Check whether the given polyglot data is valid.

Parameters

polyglot_data (PolyglotTextData) –

Returns

is_valid (bool):

error_message (Text):

Return type

tuple

classmethod not_equal_ignore_case_text_text(a, b)bool

Returns true if A and B are linguistically not equal (A != B), ignoring case.

Parameters
Returns

Return type

bool

classmethod not_equal_text_text(a, b)bool

Returns true if A and B are linguistically not equal (A != B).

Parameters
Returns

Return type

bool

classmethod polyglot_data_to_text(polyglot_data)Text

Get the text instance created from this polyglot data.

Parameters

polyglot_data (PolyglotTextData) –

Returns

The text instance, or an empty text if the data is invalid.

Return type

Text

classmethod string_table_id_and_key_from_text(text)(out_table_id=Name, out_key=str) or None

Attempts to find the String Table ID and key used by the given text.

Parameters

text (Text) –

Returns

True if the String Table ID and key were found, false otherwise.

out_table_id (Name):

out_key (str):

Return type

tuple or None

classmethod text_from_string_table(table_id, key)Text

Attempts to create a text instance from a string table ID and key. note: This exists to allow programmatic ‎look-up of a string table entry from dynamic content - you should favor setting your string table reference on a text property or pin wherever possible as it is significantly more robust (see “Make Literal Text”).

Parameters
  • table_id (Name) –

  • key (str) –

Returns

The found text, or a dummy text if the entry could not be found.

Return type

Text

classmethod text_is_culture_invariant(text)bool

Returns true if text is culture invariant.

Parameters

text (Text) –

Returns

Return type

bool

classmethod text_is_empty(text)bool

Returns true if text is empty.

Parameters

text (Text) –

Returns

Return type

bool

classmethod text_is_from_string_table(text)bool

Returns true if the given text is referencing a string table.

Parameters

text (Text) –

Returns

Return type

bool

classmethod text_is_transient(text)bool

Returns true if text is transient.

Parameters

text (Text) –

Returns

Return type

bool

classmethod text_to_lower(text)Text

Transforms the text to lowercase in a culture correct way. note: The returned instance is linked to the original and will be rebuilt if the active culture is changed.

Parameters

text (Text) –

Returns

Return type

Text

classmethod text_to_upper(text)Text

Transforms the text to uppercase in a culture correct way. note: The returned instance is linked to the original and will be rebuilt if the active culture is changed.

Parameters

text (Text) –

Returns

Return type

Text

classmethod text_trim_preceding(text)Text

Removes whitespace characters from the front of the text.

Parameters

text (Text) –

Returns

Return type

Text

classmethod text_trim_preceding_and_trailing(text)Text

Removes whitespace characters from the front and end of the text.

Parameters

text (Text) –

Returns

Return type

Text

classmethod text_trim_trailing(text)Text

Removes trailing whitespace characters.

Parameters

text (Text) –

Returns

Return type

Text