diff --git a/src/aaa-strings.adb b/src/aaa-strings.adb index 666190f..8f6cd3a 100644 --- a/src/aaa-strings.adb +++ b/src/aaa-strings.adb @@ -409,6 +409,19 @@ package body AAA.Strings is -- To_Vector -- --------------- + function To_Vector (This : Set) return Vector is + begin + return V : Vector do + for Elem of This loop + V.Append (Elem); + end loop; + end return; + end To_Vector; + + --------------- + -- To_Vector -- + --------------- + function To_Vector (S : String) return Vector is begin return V : Vector do @@ -416,6 +429,19 @@ package body AAA.Strings is end return; end To_Vector; + ------------ + -- To_Set -- + ------------ + + function To_Set (V : Vector'Class) return Set is + begin + return S : Set do + for Elem of V loop + S.Include (Elem); + end loop; + end return; + end To_Set; + ---------- -- Trim -- ---------- diff --git a/src/aaa-strings.ads b/src/aaa-strings.ads index df2d59f..0d53019 100644 --- a/src/aaa-strings.ads +++ b/src/aaa-strings.ads @@ -6,6 +6,8 @@ with Ada.Containers.Indefinite_Vectors; package AAA.Strings with Preelaborate is + type Vector; + function Camel_To_Mixed (S : String) return String; -- Converts ThisThing into This_Thing @@ -86,6 +88,8 @@ package AAA.Strings with Preelaborate is Empty_Set : constant Set; + function To_Vector (This : Set) return Vector; + ------------- -- Vectors -- ------------- @@ -180,6 +184,9 @@ package AAA.Strings with Preelaborate is -- Return V without its first element. If Allow_Empty, tail of an empty -- vector will be another empty vector. + function To_Set (V : Vector'Class) return Set; + -- Note that this will drop duplicates + not overriding function To_Vector (S : String) return Vector;