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.
(在这种情况下,其中一个字符串就足够了)。