LR Learning notes-parameters and variables

Source: Internet
Author: User

I. Use of parameters in LR

The parameters in LR are indicated by default with "{}", and if you want to modify it, you can set the boundary character of the parameter options/parameterization

Frequently used functions:

    • Lr_save_string ("string", Parameter name), save string as argument
    • void Lr_save_datetime (const char *format, int offset, const char *name); Save the time date as a parameter
    • int lr_save_init (int value, const char *param_name), save integer as argument
    • lr_param_sprintf () to write a certain format as a parameter
    • Lr_param_increment (), add an action to the number stored in the parameter

Cases:

int index=2;

char * suffix= "TXT";

lr_param_sprintf ("Log_name_param", "log_%d.%s", index,suffix,100)

Lr_output_message ("The new file name is%s", lr_eval_string ("{Log_name_param}"));

Output result: The new file name is Log_2.txt

Second, the use of variables in LR

Variables can be defined directly in LR, but must be defined before system functions (that is, before all LR functions)

Example: int or char name[20]

Three, the difference between the variable and the parameter

1. Scope

The scope of the parameter is global, and the scope of the variable needs to be declared in the Globals.h file as a global scope

2. Use in LR

Parameters can be applied directly in the system function, the variables are C language cannot be directly applied in the system function

Cases:

Variable notation:

Char url[100];

strcpy (URL, "url=www.baidu.com")

Web_url ("Baidu", Url,last);

Parameter notation:

Lr_save_string ("www.baidu.com", url)

Web_url ("Baidu", "Url={url}", last);

Iv. Array of parameters

    • The parameter array must begin with the same parameter name, followed by an underscore and then numerically assigned
    • The parameter array must have a parameter named _count to record the length of the array

Functions that are frequently used in parameter arrays:

Lr_paramarr_idx (): Take out the value of a number in the parameter array, or use Lr_eval_stirng ("{Parameter name _ number}")

Lr_paramarr_len (): Gets the length of the parameter array, or you can use Lr_eval_string ("{parameter name _count}")

Lr_paramarr_random (): Get a random value in the parameter array

LR Learning notes-parameters and variables

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.