The substr function returns a part of a string. The first parameter is the original string, the second is the start position, and the third is the number of characters to read.
static void Datatypes_string_substr(Args _args)
{
str carBrand;
;
carBrand = "Volkswagen";
print substr(carBrand, 6, 5);
pause;
}
The print command from the method will display wagen as the substring starts at position 6 of the value of the first parameter, which is Volkswagen, and reads 5 characters ahead.
static void Datatypes_string_substr(Args _args)
{
str carBrand;
;
carBrand = "Volkswagen";
print substr(carBrand, 6, 5);
pause;
}
The print command from the method will display wagen as the substring starts at position 6 of the value of the first parameter, which is Volkswagen, and reads 5 characters ahead.
This comment has been removed by the author.
ReplyDelete