Ada 编程/库/Ada.Strings.Bounded
外观
此语言功能从 Ada 95 开始可用。
Ada.Strings.Bounded 是 预定义语言环境 自 Ada 95 以来的一部分。
-- Standard Ada library specification -- Copyright (c) 2003-2018 Maxim Reznik <reznikmm@gmail.com> -- Copyright (c) 2004-2016 AXE Consultants -- Copyright (c) 2004, 2005, 2006 Ada-Europe -- Copyright (c) 2000 The MITRE Corporation, Inc. -- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc. -- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual -- -------------------------------------------------------------------------withAda.Strings.Maps;packageAda.Strings.BoundedispragmaPreelaborate (Bounded);genericMax : Positive; -- Maximum length of a Bounded_StringpackageGeneric_Bounded_LengthisMax_Length :constantPositive := Max;typeBounded_Stringisprivate; Null_Bounded_String :constantBounded_String;subtypeLength_RangeisNaturalrange0 .. Max_Length;functionLength (Source :inBounded_String)returnLength_Range; -- Conversion, Concatenation, and Selection functionsfunctionTo_Bounded_String (Source :inString; Drop :inTruncation := Error)returnBounded_String;functionTo_String (Source :inBounded_String)returnString;procedureSet_Bounded_String (Target :outBounded_String; Source :inString; Drop :inTruncation := Error);functionAppend (Left, Right :inBounded_String; Drop :inTruncation := Error)returnBounded_String;functionAppend (Left :inBounded_String; Right :inString; Drop :inTruncation := Error)returnBounded_String;functionAppend (Left :inString; Right :inBounded_String; Drop :inTruncation := Error)returnBounded_String;functionAppend (Left :inBounded_String; Right :inCharacter; Drop :inTruncation := Error)returnBounded_String;functionAppend (Left :inCharacter; Right :inBounded_String; Drop :inTruncation := Error)returnBounded_String;procedureAppend (Source :inoutBounded_String; New_Item :inBounded_String; Drop :inTruncation := Error);procedureAppend (Source :inoutBounded_String; New_Item :inString; Drop :inTruncation := Error);procedureAppend (Source :inoutBounded_String; New_Item :inCharacter; Drop :inTruncation := Error);function"&" (Left, Right :inBounded_String)returnBounded_String;function"&" (Left :inBounded_String; Right :inString)returnBounded_String;function"&" (Left :inString; Right :inBounded_String)returnBounded_String;function"&" (Left :inBounded_String; Right :inCharacter)returnBounded_String;function"&" (Left :inCharacter; Right :inBounded_String)returnBounded_String;functionElement (Source :inBounded_String; Index :inPositive)returnCharacter;procedureReplace_Element (Source :inoutBounded_String; Index :inPositive; By :inCharacter);functionSlice (Source :inBounded_String; Low :inPositive; High :inNatural)returnString;functionBounded_Slice (Source :inBounded_String; Low :inPositive; High :inNatural)returnBounded_String;procedureBounded_Slice (Source :inBounded_String; Target :outBounded_String; Low :inPositive; High :inNatural);function"=" (Left, Right :inBounded_String)returnBoolean;function"=" (Left :inBounded_String; Right :inString)returnBoolean;function"=" (Left :inString; Right :inBounded_String)returnBoolean;function"<" (Left, Right :inBounded_String)returnBoolean;function"<" (Left :inBounded_String; Right :inString)returnBoolean;function"<" (Left :inString; Right :inBounded_String)returnBoolean;function"<=" (Left, Right :inBounded_String)returnBoolean;function"<=" (Left :inBounded_String; Right :inString)returnBoolean;function"<=" (Left :inString; Right :inBounded_String)returnBoolean;function">" (Left, Right :inBounded_String)returnBoolean;function">" (Left :inBounded_String; Right :inString)returnBoolean;function">" (Left :inString; Right :inBounded_String)returnBoolean;function">=" (Left, Right :inBounded_String)returnBoolean;function">=" (Left :inBounded_String; Right :inString)returnBoolean;function">=" (Left :inString; Right :inBounded_String)returnBoolean; -- Search subprogramsfunctionIndex (Source :inBounded_String; Pattern :inString; From :inPositive; Going :inDirection := Forward; Mapping :inMaps.Character_Mapping := Maps.Identity)returnNatural;functionIndex (Source :inBounded_String; Pattern :inString; From :inPositive; Going :inDirection := Forward; Mapping :inMaps.Character_Mapping_Function)returnNatural;functionIndex (Source :inBounded_String; Pattern :inString; Going :inDirection := Forward; Mapping :inMaps.Character_Mapping := Maps.Identity)returnNatural;functionIndex (Source :inBounded_String; Pattern :inString; Going :inDirection := Forward; Mapping :inMaps.Character_Mapping_Function)returnNatural;functionIndex (Source :inBounded_String; Set :inMaps.Character_Set; From :inPositive; Test :inMembership := Inside; Going :inDirection := Forward)returnNatural;functionIndex (Source :inBounded_String; Set :inMaps.Character_Set; Test :inMembership := Inside; Going :inDirection := Forward)returnNatural;functionIndex_Non_Blank (Source :inBounded_String; From :inPositive; Going :inDirection := Forward)returnNatural;functionIndex_Non_Blank (Source :inBounded_String; Going :inDirection := Forward)returnNatural;functionCount (Source :inBounded_String; Pattern :inString; Mapping :inMaps.Character_Mapping := Maps.Identity)returnNatural;functionCount (Source :inBounded_String; Pattern :inString; Mapping :inMaps.Character_Mapping_Function)returnNatural;functionCount (Source :inBounded_String; Set :inMaps.Character_Set)returnNatural;procedureFind_Token (Source :inBounded_String; Set :inMaps.Character_Set; Test :inMembership; First :outPositive; Last :outNatural); -- String translation subprogramsfunctionTranslate (Source :inBounded_String; Mapping :inMaps.Character_Mapping)returnBounded_String;procedureTranslate (Source :inoutBounded_String; Mapping :inMaps.Character_Mapping);functionTranslate (Source :inBounded_String; Mapping :inMaps.Character_Mapping_Function)returnBounded_String;procedureTranslate (Source :inoutBounded_String; Mapping :inMaps.Character_Mapping_Function); -- String transformation subprogramsfunctionReplace_Slice (Source :inBounded_String; Low :inPositive; High :inNatural; By :inString; Drop :inTruncation := Error)returnBounded_String;procedureReplace_Slice (Source :inoutBounded_String; Low :inPositive; High :inNatural; By :inString; Drop :inTruncation := Error);functionInsert (Source :inBounded_String; Before :inPositive; New_Item :inString; Drop :inTruncation := Error)returnBounded_String;procedureInsert (Source :inoutBounded_String; Before :inPositive; New_Item :inString; Drop :inTruncation := Error);functionOverwrite (Source :inBounded_String; Position :inPositive; New_Item :inString; Drop :inTruncation := Error)returnBounded_String;procedureOverwrite (Source :inoutBounded_String; Position :inPositive; New_Item :inString; Drop :inTruncation := Error);functionDelete (Source :inBounded_String; From :inPositive; Through :inNatural)returnBounded_String;procedureDelete (Source :inoutBounded_String; From :inPositive; Through :inNatural); -- String selector subprogramsfunctionTrim (Source :inBounded_String; Side :inTrim_End)returnBounded_String;procedureTrim (Source :inoutBounded_String; Side :inTrim_End);functionTrim (Source :inBounded_String; Left :inMaps.Character_Set; Right :inMaps.Character_Set)returnBounded_String;procedureTrim (Source :inoutBounded_String; Left :inMaps.Character_Set; Right :inMaps.Character_Set);functionHead (Source :inBounded_String; Count :inNatural; Pad :inCharacter := Space; Drop :inTruncation := Error)returnBounded_String;procedureHead (Source :inoutBounded_String; Count :inNatural; Pad :inCharacter := Space; Drop :inTruncation := Error);functionTail (Source :inBounded_String; Count :inNatural; Pad :inCharacter := Space; Drop :inTruncation := Error)returnBounded_String;procedureTail (Source :inoutBounded_String; Count :inNatural; Pad :inCharacter := Space; Drop :inTruncation := Error); -- String constructor subprogramsfunction"*" (Left :inNatural; Right :inCharacter)returnBounded_String;function"*" (Left :inNatural; Right :inString)returnBounded_String;function"*" (Left :inNatural; Right :inBounded_String)returnBounded_String;functionReplicate (Count :inNatural; Item :inCharacter; Drop :inTruncation := Error)returnBounded_String;functionReplicate (Count :inNatural; Item :inString; Drop :inTruncation := Error)returnBounded_String;functionReplicate (Count :inNatural; Item :inBounded_String; Drop :inTruncation := Error)returnBounded_String;privatetypeBounded_Stringisnullrecord; Null_Bounded_String :constantBounded_String := (nullrecord);endGeneric_Bounded_Length;endAda.Strings.Bounded;
外部示例
[编辑源代码]- 在以下位置搜索
Ada.Strings.Bounded的示例:Rosetta Code、GitHub (gists)、任何 Alire 包 或 本。 - 在以下位置搜索与
Ada.Strings.Bounded相关的帖子:Stack Overflow、comp.lang.ada 或 任何与 Ada 相关的页面。
FSF GNAT
- 规范:a-strbou.ads
- 主体:a-strbou.adb
drake
