with Ada.Text_IO;
use Ada.Text_IO;
procedure StrngCmp is
MY_CAR : constant STRING := "Ford";
YOUR_CAR : constant STRING := "FORD";
Her_Car : STRING(1..8) := "Mercedes";
Rental : STRING(1..4);
Lease : STRING(1..4);
begin
if MY_CAR /= YOUR_CAR then
Put_Line("Case matters in a STRING constant or variable");
end if;
Her_Car := "Ford "; -- This is still not equal to My_Car
Rental := MY_CAR;
Rental := "Junk";
Lease := Rental;
If Rental = "Junk" then
Put_Line("A variable can be compared to a string literal.");
end if;
end StrngCmp;
053.字符串之间的判等运算
最新推荐文章于 2022-05-05 21:23:25 发布