A String is a variable-length sequence of UTF-32 encoded Unicode characters. The String class provides methods and operators to simplify using character sequences.
String objects can be created on demand or can be obtained from other entities.
To retrieve and modify String objects stored in a BaseContainer respectively use:
See also BaseContainer Manual.
To retrieve and modify String objects stored in a GeData object (GeData type is DA_STRING) respectively use:
See also GeData Manual.
Strings are also registered in resource files. Each of these strings has an ID in cd4_symbols.h
and is defined in a *
.str file in the string folder of a specific language. This way a plugin can easily be localized by adding str
files for each supported language.
If it is needed that the user enters or edits a String a special dialog can be used:
A String can be copied with the default operator:
Multiple String objects can be combined with the usual operators:
The String class provides functions to find substrings in a given string or character:
The String class provides functions to return substrings of a given string:
It is also possible to accesses a single character directly:
The String class provides functions to compare to String objects:
A string can be converted to a number when the stored characters describe a number. This might be useful for example to handle user input:
Also a more generic function is available:
Several static functions can be used to convert both 32 and 64 bit numbers to strings:
Also:
A typical string operation is to convert all characters to upper or lowercase characters. These functions only work with ANSI characters less than character code 128, all other characters remain unchanged:
Sometimes strings must be communicated with other libraries. In this case it is needed to convert a Cinema 4D String into a standard string:
The Filename class is used to handle filenames and paths. Its content can be defined with strings and be converted to strings:
See also Filename Manual.
The class DateTimeParser can be used to parse and create date time strings.
Similar functionality is also provided by functions of the datetime library:
asctime()
function of the standard library.A String object can be stored in a BaseFile or a HyperFile using:
See also BaseFile Manual on String and HyperFile Manual on String.
Regular expressions are used to check if a given string matches a certain pattern. The class RegularExprParser provides basic functionality to parse for simple expressions:
The parser is used with these functions:
Some symbols may be OS depended. These functions exist to get the correct symbol in each environment: