Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String 将无界字符串转换为整数Ada_String_Ada - Fatal编程技术网

String 将无界字符串转换为整数Ada

String 将无界字符串转换为整数Ada,string,ada,String,Ada,我的问题很简单,因为谷歌让我失望了。如何将无界字符串转换为整数 如果字符串是有界的,我可以这样做:I:Integer:=Integer'Value(“613”) 但是,我的字符串是无界的,Ada抛出以下错误: 应为类型“Standard.String” 找到私有类型“Ada.Strings.Unbounded.Unbounded_String” 我想做的是可能的吗?您只需进行中间转换: I : Integer := Integer'Value (To_String (T)); 以下是完整的测

我的问题很简单,因为谷歌让我失望了。如何将无界字符串转换为整数

如果字符串是有界的,我可以这样做:
I:Integer:=Integer'Value(“613”)

但是,我的字符串是无界的,Ada抛出以下错误:

应为类型“Standard.String”
找到私有类型“Ada.Strings.Unbounded.Unbounded_String”


我想做的是可能的吗?

您只需进行中间转换:

I : Integer := Integer'Value (To_String (T));
以下是完整的测试程序:

with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Text_IO; use Ada.Text_IO;

procedure Main is
   T : Unbounded_String := To_Unbounded_String ("613");
   I : Integer := Integer'Value (To_String (T));
begin
   Put_Line (I'Image);
end Main;