The string data type is probably one of the most used data types. It is used to hold text information, and its length can either be set while declaring the variable or it can be dynamic. When using fixed length strings simply add the number of characters you would like to limit the variable to between the variable type and the name of the variable, as shown in the next example.
Also note that the variable type keyword is str and not string.
static void Datatypes_string1(Args _args)
{
str 7 fixedLengthString;
str dynamicLengthString;
;
fixedLengthString = "Welcome to Carz Inc";
dynamicLengthString = "Welcome to Carz Inc";
print fixedLengthString;
print dynamicLengthString;
pause;
}
When working with strings there are some functions that are nice to know about, that help you manipulate strings, search for text inside a string, and so on. These functions can be found in the Application Object Tree (AOT) under System Documentation\Functions and some under Classes\Global.
I will show just a few of these functions in this chapter but you should get familiar with more of them by browsing the AOT and trying them out yourself.
Also note that the variable type keyword is str and not string.
static void Datatypes_string1(Args _args)
{
str 7 fixedLengthString;
str dynamicLengthString;
;
fixedLengthString = "Welcome to Carz Inc";
dynamicLengthString = "Welcome to Carz Inc";
print fixedLengthString;
print dynamicLengthString;
pause;
}
When working with strings there are some functions that are nice to know about, that help you manipulate strings, search for text inside a string, and so on. These functions can be found in the Application Object Tree (AOT) under System Documentation\Functions and some under Classes\Global.
I will show just a few of these functions in this chapter but you should get familiar with more of them by browsing the AOT and trying them out yourself.
No comments:
Post a Comment