Page 1 of 1

Some help with scripting functions

Posted: 2006-08-06 16:51:34
by Rigido
Hi,
I'm trying to update my script (terminalvideo.it) as they changed their site. Right now I have two problems:

1. I don't know a function to check if a given variable (string) is a "good" integer or not. I saw that If I assign a wrong value to fieldDisks it is empty so I did this:

Code: Select all

SetField (fieldDisks, sDisk);
sDisk := GetField (fieldDisks);
if Length(Trim(sDisk))=0 then
 begin
  SetField (fieldDisks, '1');
end;
There is a "clean" way to do it?

2. I put a "capitalize" function on my script but I'm experiencing some problems with roman numbers (I, II, III, etc.), can someone please help me? :wink:

Thanks you all...

Posted: 2006-08-06 18:34:59
by antp
1. you can do that:

Code: Select all

if StrToInt(sDisk, -1) <> -1 then
  // you have a valid integer in sDisk
To check if a string is empty or not you can also compare it to '' (empty string), it is maybe cleaner than check the length. But it still require the use of Trim if the string may contain spaces.

2. What do you do currently for this function?