Class String#

String DataSocket String supports python slicing:

s = String("ABCDEFGHIJK")

a = s[3]   # Returns String("A")
a = s[:3]  # Returns String("ABC")
a = s[3:6] # Returns String("DEF")

i = Integer(6)
j = Integer(9)

a = s[i:j] # Returns String("GHI")

Constructor#

String(self, value = "Text", label = None)

Content#

Properties

length

Inherited

bl_idname | bnode | is_multi_input | is_output | is_plugged | links | name | node_chain_label | socket_index

Class and static methods

Input | LineBreak | String | Tab | Value

Inherited

get_bl_idname | get_class_name | gives_bsocket | is_socket | is_vector | python_type_to_socket | value_data_type

Methods

equal | join | join_strings | not_equal | replace | slice | string_join | switch | to_curves

Inherited

connected_sockets | get_blender_socket | init_domains | init_socket | plug | reroute | reset_properties | stack | to_output

Properties#

length#

Returns:#

  • socket length

Go to top - main - nodes - nodes menus

Class and static methods#

Input#

@classmethod
def Input(cls, value = "Text", name = "String", description = "")

Create a String input socket in the Group Input Node

Args:#

  • value: The default value

  • name: The socket name

  • description: User tip

Returns:#

  • Float: The Float data socket

Go to top - main - nodes - nodes menus

LineBreak#

@staticmethod
def LineBreak()

Returns:#

  • socket line_break

Go to top - main - nodes - nodes menus

String#

@classmethod
def String(cls, string='')

Args:#

  • string (str): ‘’

Returns:#

  • socket string

Go to top - main - nodes - nodes menus

Tab#

@staticmethod
def Tab()

Returns:#

  • socket tab

Go to top - main - nodes - nodes menus

Value#

@staticmethod
def Value(value = None, decimals = None)

String constructor : initialize a String from a numeric value

Args:#

  • value: Value to convert

  • decimals: Number of decimals

s = String.Value(Float(12.34), decimal=2)

Go to top - main - nodes - nodes menus

Methods#

equal#

def equal(self, b=None)

Args:#

  • b: [‘Float’, ‘Integer’, ‘Vector’, ‘Color’, ‘String’]

Returns:#

  • socket result

Go to top - main - nodes - nodes menus

join#

def join(self, *strings)

Args:#

  • strings: String

Returns:#

  • socket string

Go to top - main - nodes - nodes menus

join_strings#

def join_strings(self, *strings, delimiter = None)

Join strings with a delimiter

Args:#

  • strings (str, String): List of strings to join

  • delimiter (str, String): Delimiter between the strings

Returns:#

  • String: strings joined with the delimiter

Note: Here, the self String is used as the first String to join. In the method join, self acts as the delimiter.

Example

s0 = String("Demo")
s1 = String("ABC")
s2 = String("BCD")
delimiter = String(", ")

s = s0.join_strings(s1, s2, "EFG", delimiter=delimiter)

# Is equivalent to the more *pythonic*:
    
s = delimiter.join(s0, s1, s2, "EFG")    

Go to top - main - nodes - nodes menus

not_equal#

def not_equal(self, b=None)

Args:#

  • b: [‘Float’, ‘Integer’, ‘Vector’, ‘Color’, ‘String’]

Returns:#

  • socket result

Go to top - main - nodes - nodes menus

replace#

def replace(self, find=None, replace=None)

Args:#

  • find: String

  • replace: String

Returns:#

  • socket string

Go to top - main - nodes - nodes menus

slice#

def slice(self, position=None, length=None)

Args:#

  • position: Integer

  • length: Integer

Returns:#

  • socket string

Go to top - main - nodes - nodes menus

string_join#

def string_join(*strings, delimiter=None)

Args:#

  • strings: String

  • delimiter: String

Returns:#

  • socket string

Go to top - main - nodes - nodes menus

switch#

def switch(self, switch=None, true=None)

Args:#

  • switch: Boolean

  • true: String

Returns:#

  • socket output

Go to top - main - nodes - nodes menus

to_curves#

def to_curves(self, size=None, character_spacing=None, word_spacing=None, line_spacing=None, text_box_width=None, text_box_height=None, align_x='LEFT', align_y='TOP_BASELINE', overflow='OVERFLOW', pivot_mode='BOTTOM_LEFT')

Args:#

  • size: Float

  • character_spacing: Float

  • word_spacing: Float

  • line_spacing: Float

  • text_box_width: Float

  • text_box_height: Float

  • align_x (str): ‘LEFT’ in [LEFT, CENTER, RIGHT, JUSTIFY, FLUSH]

  • align_y (str): ‘TOP_BASELINE’ in [TOP_BASELINE, TOP, MIDDLE, BOTTOM_BASELINE, BOTTOM]

  • overflow (str): ‘OVERFLOW’ in [OVERFLOW, SCALE_TO_FIT, TRUNCATE]

  • pivot_mode (str): ‘BOTTOM_LEFT’ in [MIDPOINT, TOP_LEFT, TOP_CENTER,… , BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT]

Node Image

Returns:#

  • tuple (’curve_instances’, ‘line’, ‘pivot_point’)

Go to top - main - nodes - nodes menus