Uppercase Vs. Lowercase; Setting Uppercase And Lowercase - AMX AXCESS CONTROL SYSTEM PROGRAM Instruction Manual

Programming language
Table of Contents

Advertisement

Arrays and Strings

Uppercase vs. Lowercase

When using FIND_STRING and REMOVE_STRING, as well as when comparing two string
values, it is important to remember that such comparisons are case sensitive, which means that
uppercase and lowercase values are not evaluated the same. As you recall, the compiler is not case
sensitive when it comes to keywords and identifiers. However, the compiler is case sensitive when
it comes to values inside single quotes (string literals). Here are some examples:
DEFINE_PROGRAM
Identifier_1 = 'Fred'
Identifier_2 = 'FRED'
if (IDENTIFIER_1 = IDENTIFIER_2)
{
(* This will not be true because 'Fred' and 'FRED' are not the same. *)
}
When programming, you may use whatever capitalizing scheme you wish. As a standard at AMX,
we capitalize all keywords and identifiers in the program.
Notice that the string literals FRED and Fred are not the same. However, in the case of identifiers
Identifier_1 and Identifier_2, Axcess does not differentiate based on the case of the letters in the
identifier name. Also, notice that in this example the keyword "if" is not capitalized, making no
difference to the Axcess compiler.

Setting uppercase and lowercase

In Axcess, the lowercase letter "a" is not the same as the uppercase letter "A". Each has its own
decimal ASCII code (the code for "a" is 97, "A" is 65). This could become problematic when, for
example, your program compares the incoming string ABC against another, as shown below:
IF (ABC = 'YES')
{
}
If the incoming string is 'YES', there is no problem. The statements are executed as normal.
However, if ABC equals 'Yes', since 'YES' and 'Yes' do not have the same decimal ASCII value, the
statements below the IF statement would not be executed.
The solution is to change all incoming strings to either uppercase or lowercase. The keywords that
do this are UPPER_STRING and LOWER_STRING. For example, the following statement can be
added before the preceding program:
ABC2 = UPPER_STRING(ABC)
The IF statement can now compare ABC2 against 'YES', providing that the IF statement reads IF
(ABC2 = 'YES'). The string 'Yes' is accepted since it has been converted into uppercase.
Conversely, LOWER_STRING converts a string into lowercase.
38
(* statement(s) *)
Axcess Programming Language

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the AXCESS CONTROL SYSTEM PROGRAM and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Axcess

Table of Contents