Zee LR script Exercise 4: About the lr_eval_string Function

Source: Internet
Author: User
Tags uppercase letter

I have a few friends on the forum to discuss it. The following is an example:

In LR, C variables and LR parameters are different.
No C variable can be directly called by LR functions.
Lr_eval_string should be used.
For example, {newparam} (parameterized variable in LR) can be referenced directly.
However, if:

Action ()
{
Char A [10];
Strcpy (a, "{newparam }");
Lr_message ();
Return 0;
}

This is incorrect.
Lr_message (a); an error is returned.
But you can write it as lr_message (lr_eval_string (.
Because the value has been taken out.

Let's look at another question: One netizen said:
Action ()
{
Char A [10];
Strcpy (a, "{newparam }");
Lr_message (lr_eval_string ());
If (lr_eval_string (a) [0] = 11 ){
Lr_message ("A = % d", );
}
Return 0;
}
If (lr_eval_string (a) [0] = 11) in is not subject to syntax check.
{Newparam} is parameterized. Content: 11.

Next, I will use lr_message ("A = D", lr_eval_string (a) [0]); In Front Of if to see what it is. The result is: 49 (ASCII code of number 1 ).
That is to say, if (lr_eval_string (a) [0] = 11) is to judge whether the ASCII Code of 1 is equal to 11. The display is not equal. Therefore, the lr_message ("A = % d", a); will not be executed.

Next we will use another piece of code to look at it:

Char * str2 = "T ";
Char A [10];
Strcpy (A, lr_eval_string ("{newparam }"));

Lr_message ("A = % d", lr_eval_string (a) [0]);
Lr_message (lr_eval_string ());

If (lr_eval_string (a) [0] = * str2 ){
Lr_message ("A = % s", );
Lr_message ("execute this sentence! ");
}
The result is as follows:
Starting action.
A = 84
T
A = T
Execute this sentence!
Ending action.
Here, my parameter is an uppercase "T ".
We can see that lr_eval_string (a) [0] obtains the ASCII code of the uppercase letter "T.
 

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.