Commit 575c9f7f authored by Michael Siegel's avatar Michael Siegel 👔
Browse files

Port `_id_valid`

parent 32f88b85
......@@ -3,7 +3,7 @@
--
-- a ____ to facilitate random note-taking -- rewrite…
--
-- Version 0.28.6
-- Version 0.28.7
--
--
-- Copyright 2021 Michael Siegel
......@@ -37,7 +37,7 @@ procedure Mote is
Program_Name : constant String := "mote";
Invocation_Name : constant String := Simple_Name(Command_Name);
Program_Version : constant String := "0.28.6";
Program_Version : constant String := "0.28.7";
Base_Dir : constant String := Env_Vars.Value("HOME") & "/.mote_R";
Data_Dir : constant String := Base_Dir & "/notes";
......@@ -93,6 +93,23 @@ procedure Mote is
return To_String(Result);
end Dec_To_Base36;
function ID_Valid (ID : String) return Boolean is
Result : Boolean := true;
begin
if not (ID'Length >= 4) then
Result := false;
else
for I in ID'Range loop
if not (Character'Pos(ID(I)) in 48 .. 57
or Character'Pos(ID(I)) in 97 .. 122) then
Result := false;
end if;
end loop;
end if;
return Result;
end ID_Valid;
-------- USER COMMANDS --------
procedure Show_Help is
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment