CASE-SENSITIVE 字串
除非另有說明,否則 Progress ABL 中的所有字串都區分大小寫。
此示例將顯示一個訊息框,指出字串相同。
DEFINE VARIABLE str1 AS CHARACTER NO-UNDO.
DEFINE VARIABLE str2 AS CHARACTER NO-UNDO.
str1 = "abc".
str2 = "ABC".
IF str1 = str2 THEN
MESSAGE "The strings are identical" VIEW-AS ALERT-BOX.
要宣告字串區分大小寫,只需新增屬性 CASE-SENSITIVE
即可
DEFINE VARIABLE str1 AS CHARACTER NO-UNDO CASE-SENSITIVE.
DEFINE VARIABLE str2 AS CHARACTER NO-UNDO.
str1 = "abc".
str2 = "ABC".
IF str1 = str2 THEN
MESSAGE "The strings are identical" VIEW-AS ALERT-BOX.
ELSE
MESSAGE "There's a difference" VIEW-AS ALERT-BOX.
(在這種情況下,其中一個字串就足夠了)。