Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- @Parameter:
- -- +Str : String which is searched through
- -- +Ch : Character which is searched in the string 'Str'
- -- +Min_Index : The index
- --
- -- @Return : Returns the Index of the string where the Character -- is located, if it appears in the string
- -- --------------------------------------------------------------
- function Get_Min_Index
- (Str : String;
- Ch : Character) return Integer is
- Counter : Integer := 1;
- Min_Index : Integer := Str'First – 1;
- begin
- -- Iterate through the String from 'First to
- -- 'Last. If the given Ch is found return its
- -- index.
- if Counter <= Str'Length then
- if Str (Counter) = Ch then
- return Counter;
- end if;
- Counter := Counter + 1;
- return Get_Min_Index (Str, Ch);
- end if;
- return 0;
- end Get_Min_Index;
Add Comment
Please, Sign In to add comment