unreal.StringLibrary
¶
- class unreal.StringLibrary(outer=None, name='None')¶
Bases:
unreal.BlueprintFunctionLibrary
Kismet String Library
C++ Source:
Module: Engine
File: KismetStringLibrary.h
- classmethod build_string_bool(append_to, prefix, bool, suffix) → str¶
Converts a boolean->string, creating a new string in the form AppendTo+Prefix+InBool+Suffix
- Parameters
append_to (str) – An existing string to use as the start of the conversion string
prefix (str) – A string to use as a prefix, after the AppendTo string
bool (bool) – The bool value to convert. Will add “true” or “false” to the conversion string
suffix (str) – A suffix to append to the end of the conversion string
- Returns
A new string built from the passed parameters
- Return type
- classmethod build_string_color(append_to, prefix, color, suffix) → str¶
Converts a color->string, creating a new string in the form AppendTo+Prefix+InColor+Suffix
- Parameters
append_to (str) – An existing string to use as the start of the conversion string
prefix (str) – A string to use as a prefix, after the AppendTo string
color (LinearColor) – The linear color value to convert. Uses the standard ToString conversion
suffix (str) – A suffix to append to the end of the conversion string
- Returns
A new string built from the passed parameters
- Return type
- classmethod build_string_float(append_to, prefix, float, suffix) → str¶
Converts a float->string, create a new string in the form AppendTo+Prefix+InFloat+Suffix
- Parameters
- Returns
A new string built from the passed parameters
- Return type
- classmethod build_string_int(append_to, prefix, int, suffix) → str¶
Converts a int->string, creating a new string in the form AppendTo+Prefix+InInt+Suffix
- Parameters
- Returns
A new string built from the passed parameters
- Return type
- classmethod build_string_int_vector(append_to, prefix, int_vector, suffix) → str¶
Converts an IntVector->string, creating a new string in the form AppendTo+Prefix+InIntVector+Suffix
- Parameters
append_to (str) – An existing string to use as the start of the conversion string
prefix (str) – A string to use as a prefix, after the AppendTo string
int_vector (IntVector) – The intVector value to convert. Uses the standard FVector::ToString conversion
suffix (str) – A suffix to append to the end of the conversion string
- Returns
A new string built from the passed parameters
- Return type
- classmethod build_string_name(append_to, prefix, name, suffix) → str¶
Converts a color->string, creating a new string in the form AppendTo+Prefix+InName+Suffix
- Parameters
- Returns
A new string built from the passed parameters
- Return type
- classmethod build_string_object(append_to, prefix, obj, suffix) → str¶
Converts a object->string, creating a new string in the form AppendTo+Prefix+object name+Suffix
- Parameters
append_to (str) – An existing string to use as the start of the conversion string
prefix (str) – A string to use as a prefix, after the AppendTo string
obj (Object) – The object to convert. Will insert the name of the object into the conversion string
suffix (str) – A suffix to append to the end of the conversion string
- Returns
A new string built from the passed parameters
- Return type
- classmethod build_string_rotator(append_to, prefix, rot, suffix) → str¶
Converts a rotator->string, creating a new string in the form AppendTo+Prefix+InRot+Suffix
- Parameters
append_to (str) – An existing string to use as the start of the conversion string
prefix (str) – A string to use as a prefix, after the AppendTo string
rot (Rotator) – The rotator value to convert. Uses the standard ToString conversion
suffix (str) – A suffix to append to the end of the conversion string
- Returns
A new string built from the passed parameters
- Return type
- classmethod build_string_vector(append_to, prefix, vector, suffix) → str¶
Converts a vector->string, creating a new string in the form AppendTo+Prefix+InVector+Suffix
- Parameters
append_to (str) – An existing string to use as the start of the conversion string
prefix (str) – A string to use as a prefix, after the AppendTo string
vector (Vector) – The vector value to convert. Uses the standard FVector::ToString conversion
suffix (str) – A suffix to append to the end of the conversion string
- Returns
A new string built from the passed parameters
- Return type
- classmethod build_string_vector2d(append_to, prefix, vector2d, suffix) → str¶
Converts a vector2d->string, creating a new string in the form AppendTo+Prefix+InVector2d+Suffix
- Parameters
append_to (str) – An existing string to use as the start of the conversion string
prefix (str) – A string to use as a prefix, after the AppendTo string
vector2d (Vector2D) – The vector2d value to convert. Uses the standard FVector2D::ToString conversion
suffix (str) – A suffix to append to the end of the conversion string
- Returns
A new string built from the passed parameters
- Return type
- classmethod contains(search_in, substring, use_case=False, search_from_end=False) → bool¶
Returns whether this string contains the specified substring.
- classmethod conv_bool_to_string(bool) → str¶
Converts a boolean value to a string, either ‘true’ or ‘false’
- classmethod conv_byte_to_string(byte) → str¶
Converts a byte value to a string
- Parameters
byte (uint8) –
- Returns
- Return type
- classmethod conv_color_to_string(color) → str¶
Converts a linear color value to a string, in the form ‘(R=,G=,B=,A=)’
- Parameters
color (LinearColor) –
- Returns
- Return type
- classmethod conv_int_point_to_string(int_point) → str¶
Converts an IntPoint value to a string, in the form ‘X= Y=’
- classmethod conv_int_to_string(int) → str¶
Converts an integer value to a string
- Parameters
int (int32) –
- Returns
- Return type
- classmethod conv_int_vector_to_string(int_vec) → str¶
Converts an IntVector value to a string, in the form ‘X= Y= Z=’
- classmethod conv_object_to_string(obj) → str¶
Converts a UObject value to a string by calling the object’s GetName method
- classmethod conv_rotator_to_string(rot) → str¶
Converts a rotator value to a string, in the form ‘P= Y= R=’
- classmethod conv_string_to_color(string) -> (out_converted_color=LinearColor, out_is_valid=bool)¶
Convert String Back To Color. IsValid indicates whether or not the string could be successfully converted.
- Parameters
string (str) –
- Returns
out_converted_color (LinearColor):
out_is_valid (bool):
- Return type
tuple
- classmethod conv_string_to_int(string) → int32¶
Converts a string to a int value
- Parameters
string (str) –
- Returns
- Return type
int32
- classmethod conv_string_to_rotator(string) -> (out_converted_rotator=Rotator, out_is_valid=bool)¶
Convert String Back To Rotator. IsValid indicates whether or not the string could be successfully converted.
- Parameters
string (str) –
- Returns
out_converted_rotator (Rotator):
out_is_valid (bool):
- Return type
tuple
- classmethod conv_string_to_vector(string) -> (out_converted_vector=Vector, out_is_valid=bool)¶
Convert String Back To Vector. IsValid indicates whether or not the string could be successfully converted.
- Parameters
string (str) –
- Returns
out_converted_vector (Vector):
out_is_valid (bool):
- Return type
tuple
- classmethod conv_string_to_vector2d(string) -> (out_converted_vector2d=Vector2D, out_is_valid=bool)¶
Convert String Back To Vector2D. IsValid indicates whether or not the string could be successfully converted.
- Parameters
string (str) –
- Returns
out_converted_vector2d (Vector2D):
out_is_valid (bool):
- Return type
tuple
- classmethod conv_transform_to_string(trans) → str¶
Converts a transform value to a string, in the form ‘Translation: X= Y= Z= Rotation: P= Y= R= Scale: X= Y= Z=’
- classmethod conv_vector2d_to_string(vec) → str¶
Converts a vector2d value to a string, in the form ‘X= Y=’
- classmethod conv_vector_to_string(vec) → str¶
Converts a vector value to a string, in the form ‘X= Y= Z=’
- classmethod cull_array(source_string) -> (int32, array=Array(str))¶
Takes an array of strings and removes any zero length entries.
- classmethod ends_with(source_string, suffix, search_case=SearchCase.IGNORE_CASE) → bool¶
Test whether this string ends with given string.
- Parameters
source_string (str) –
suffix (str) –
search_case (SearchCase) – Indicates whether the search is case sensitive or not ( defaults to ESearchCase::IgnoreCase )
- Returns
true if this string ends with specified text, false otherwise
- Return type
- classmethod equal_equal_stri_stri(a, b) → bool¶
Test if the input strings are equal (A == B), ignoring case
- classmethod find_substring(search_in, substring, use_case=False, search_from_end=False, start_position=- 1) → int32¶
Finds the starting index of a substring in the a specified string
- Parameters
search_in (str) – The string to search within
substring (str) – The string to look for in the SearchIn string
use_case (bool) – Whether or not to be case-sensitive
search_from_end (bool) – Whether or not to start the search from the end of the string instead of the beginning
start_position (int32) – The position to start the search from
- Returns
The index (starting from 0 if bSearchFromEnd is false) of the first occurence of the substring
- Return type
int32
- classmethod get_character_array_from_string(source_string)¶
Returns an array that contains one entry for each character in SourceString
- classmethod get_character_as_number(source_string, index=0) → int32¶
Gets a single character from the string (as an integer)
- Parameters
source_string (str) – The string to convert
index (int32) – Location of the character whose value is required
- Returns
The integer value of the character or 0 if index is out of range
- Return type
int32
- classmethod get_substring(source_string, start_index=0, length=1) → str¶
Returns a substring from the string starting at the specified position
- classmethod join_string_array(source_array, separator=' ') → str¶
Concatenates an array of strings into a single string.
- classmethod left_chop(source_string, count) → str¶
Returns the left most characters from the string chopping the given number of characters from the end
- classmethod left_pad(source_string, ch_count) → str¶
Pad the left of this string for a specified number of characters
- classmethod len(s) → int32¶
Returns the number of characters in the string
- Parameters
s (str) –
- Returns
The number of chars in the string
- Return type
int32
- classmethod matches_wildcard(source_string, wildcard, search_case=SearchCase.IGNORE_CASE) → bool¶
Searches this string for a given wild card warning: This is a simple, SLOW routine. Use with caution
- classmethod mid(source_string, start, count) → str¶
Returns the substring from Start position for Count characters.
- classmethod not_equal_stri_stri(a, b) → bool¶
Test if the input string are not equal (A != B), ignoring case differences
- classmethod parse_into_array(source_string, delimiter=' ', cull_empty_strings=True)¶
Gets an array of strings from a source string divided up by a separator and empty strings can optionally be culled.
- classmethod replace(source_string, from_, to, search_case=SearchCase.IGNORE_CASE) → str¶
Replace all occurrences of a substring in this string
- Parameters
source_string (str) –
from (str) – substring to replace
to (str) – substring to replace From with
search_case (SearchCase) – Indicates whether the search is case sensitive or not ( defaults to ESearchCase::IgnoreCase )
- Returns
a copy of this string with the replacement made
- Return type
- classmethod replace_inline(source_string, search_text, replacement_text, search_case=SearchCase.IGNORE_CASE) -> (int32, source_string=str)¶
Replace all occurrences of SearchText with ReplacementText in this string.
- Parameters
source_string (str) –
search_text (str) – the text that should be removed from this string
replacement_text (str) – the text to insert in its place
search_case (SearchCase) – Indicates whether the search is case sensitive or not ( defaults to ESearchCase::IgnoreCase )
- Returns
the number of occurrences of SearchText that were replaced.
source_string (str):
- Return type
- classmethod reverse(source_string) → str¶
Returns a copy of this string, with the characters in reverse order
- classmethod right(source_string, count) → str¶
Returns the string to the right of the specified location, counting back from the right (end of the word).
- classmethod right_chop(source_string, count) → str¶
Returns the string to the right of the specified location, counting forward from the left (from the beginning of the word).
- classmethod right_pad(source_string, ch_count) → str¶
Pad the right of this string for a specified number of characters
- classmethod split(source_string, str, search_case=SearchCase.IGNORE_CASE, search_dir=SearchDir.FROM_START) → (left_s=str, right_s=str) or None¶
Splits this string at given string position case sensitive.
- Parameters
source_string (str) –
str (str) – The string to search and split at
search_case (SearchCase) – Indicates whether the search is case sensitive or not ( defaults to ESearchCase::IgnoreCase )
search_dir (SearchDir) – Indicates whether the search starts at the begining or at the end ( defaults to ESearchDir::FromStart )
- Returns
true if string is split, otherwise false
left_s (str): out the string to the left of InStr, not updated if return is false
right_s (str): out the string to the right of InStr, not updated if return is false
- Return type
tuple or None
- classmethod starts_with(source_string, prefix, search_case=SearchCase.IGNORE_CASE) → bool¶
Test whether this string starts with given string.
- Parameters
source_string (str) –
prefix (str) –
search_case (SearchCase) – Indicates whether the search is case sensitive or not ( defaults to ESearchCase::IgnoreCase )
- Returns
true if this string begins with specified text, false otherwise
- Return type
- classmethod time_seconds_to_string(seconds) → str¶
Convert a number of seconds into minutes:seconds.milliseconds format string (including leading zeroes)