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;
052.字符串之间的比较运算
最新推荐文章于 2024-08-23 16:37:54 发布