StringValue#
- class ansys.tools.variableinterop.scalar_values.StringValue#
Bases:
numpy.str_,ansys.tools.variableinterop.variable_value.IVariableValueStores a value as an
IVariableValuevariable type.In Python, the
IntegerValuetype is implemented by extending NumPy’sstr\_type. This means that they decay naturally intonumpy.str\_objects when used with other types of operators. It also means that they inherit many of the NumPy behaviors, which may be slightly different from the behaviors specified in the variable interop standards. For example, when converting from string to integer, values parseable as floating- point numbers are rejected instead of parsed as such and then rounded. If you want the variable interop standard conversions, use thefrom_api_string()method on any given variable interop type to get an instance of that type, which should decompose naturally to the analogous NumPy type.
Overview#
Invoke the visitor pattern of this object using the passed-in visitor |
|
Convert the value to an API string. |
|
Convert the value to a formatted string. |
Variable type of the object. |
Convert an API string back to a string value. |
Import detail#
from ansys.tools.variableinterop.scalar_values import StringValue
Property detail#
- property StringValue.variable_type: ansys.tools.variableinterop.variable_type.VariableType#
Variable type of the object.
- Returns:
VariableTypeVariable type of the object.
Method detail#
- StringValue.accept(visitor: ansys.tools.variableinterop.ivariable_visitor.IVariableValueVisitor[ansys.tools.variableinterop.ivariable_visitor.T]) ansys.tools.variableinterop.ivariable_visitor.T#
Invoke the visitor pattern of this object using the passed-in visitor implementation.
- Parameters:
- visitor
IVariableValueVisitor Visitor object to call.
- visitor
- Returns:
TResults of the visitor invocation.
- StringValue.to_api_string(context: ansys.tools.variableinterop.isave_context.ISaveContext | None = None) str#
Convert the value to an API string.
- Returns:
strString appropriate for use in files and APIs.
- static StringValue.from_api_string(value: str) StringValue#
Convert an API string back to a string value.
The string is stored exactly as specified. No escaping is performed as with the
from_formatted string()method.- Parameters:
- value
str String to convert.
- value