From: "Björn Lundin" <b.f.lundin@gmail.com>
Subject: Re: How to check if letters are in a string?
Date: Sat, 18 Jul 2015 13:36:25 +0200
Date: 2015-07-18T13:36:25+02:00 [thread overview]
Message-ID: <moddin$20u$1@dont-email.me> (raw)
In-Reply-To: <53a16384-fa63-479c-9421-553683dd6009@googlegroups.com>
Looks like I managed to mail this to the op instead of post it to c.l.a ...
On 2015-07-18 11:00, Trish Cayetano wrote:
> Is there another way how to check if (exact number of) letters are in
a string?
> Thank you very much!
declare
My_Letters: string := "HID"
My_String: string := "HIDDEN"
Is_In_String : boolean := False;
begin
for L in My_Letters'range loop
Is_In_String := False;
for S in My_String'range loop
if My_Letters(L) = My_String(S) then
Is_In_String := True;
My_String(S) := ' '; --set to space, so letter is not reused
exit; -- inner loop
end if;
end loop;
exit when not Is_In_String;
end loop;
Text_io.put_Line("Is_In_String = "& Is_In_String'Img);
end;
not compiled, not tested but the spirit of it
should do what you want
-- -- Björn
--
--
Björn
next prev parent reply other threads:[~2015-07-18 11:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-18 9:00 How to check if letters are in a string? Trish Cayetano
2015-07-18 10:23 ` Nasser M. Abbasi
2015-07-18 10:52 ` Trish Cayetano
2015-07-18 11:07 ` Simon Clubley
2015-07-18 11:36 ` Björn Lundin [this message]
2015-07-18 12:48 ` Trish Cayetano
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox