Examples of Case Sensitivity in Mentor

Included are a few commands to help with case sensitivity.

Command: ~clean upshift

Command: ~clean downshift

Function: upshift()

Function: downshift()

Command: ~set case_sensitive

Command: ~freq

Command: ~sort

Variable type: $U

Variable type: $D

Variable type: $N

Pound sign variables

UPSHIFT/DOWNSHIFT

The upshift and down shift ~clean command operate directly on a data location.

The syntax is: upshift location, downshift location.

The data location being operated on may be referenced with a variable name.See casesen1.spx for examples.

CASE_SENSITIVE

If you wanta ~freq, ~sort, or pound sign variable to be case sensitive, you need to use ~set case_sensitive. The default for these is to not be casesensitive. The $N variable type will not perform non-case sensitive operations if this has not been set.

Variable types U, D, and N

The variable type U, D, and N cause variable locations to be treated as up shifted, down shifted, or not shifted, respectively.

When displaying a data location $ is the same as $n. [1.5$] and [1.5$n] will display the same thing when used on a print statement.See casesen1.spx for examples.

When case_sensitive has not been set, these variable types will effect the display of data, for example, in print statements, but they will have no effect on ~sort, ~freq, or pound sign variables.

When case_sensitive is set, these variable types may be used to force an operation to be up or down shifted.

Note: $u, $d, and $n may be used in combination with $s and $l. [1.5$lu] means the full length of the data location treated as uppercase.

FREQ

The ~freq command does a case insensitive count of the data unless one has ~set case_sensitive.Using either $U or $D on the variable on whichyou are doing a ~freq will not effect the counts for a particular string, but it will affect the display.

For Example:

Count for ‘A’ is 1 <– Using ~freq [1$U]

Count for ‘a’ is 1 <– Using ~freq [1$D]

See casesen2.spx for examples.

SORT

The ~sort command does a case insensitive sort unless case_sensitive has been set. A case sensitive ~sort will sort all lower case letters after theupper case letters.

When using either $U or $D in a ~sort, upper and lowercase versions of the same letter will group together in the order that they were encountered inthe data.See casesen3.spx for examples.

Pound sign variables

Normally pound sign variables are not case sensitive. Setting case_sensitive allows you to use check statements that will check a data location forupper vs. lower case responses. Setting case_sensitive will also allow one to tabulate data in a case sensitive manner.See casesen4.spx for examples.

UPSHIFT() and DOWNSHIFT()

These two functions return either the upshifted or downshifted version of a string handed to them. There are some times when one may not wish touse the $U or $D variable types or wish to actually change the data. In particular the downshift() function can return the lowercases version of a $Uvariable.See casesen5.spx for examples.

The upshift() and downshift() functions may also be used to change the case of text questions.See casesen6.spx for examples.

  • casesen.zip