I tried the following code which supposed to check if a string contains spaces but I get an error. How else can I check that
if Index('some string',' ')>1 then begin
Result:= False;
end
else begin
Result := True;
end;
You can use pos function. From documentation:
The
pos
function returns the position of a substring in a main string. If the substring does not exist in the main string, then the returned value will be 0.
s:='note-book';
x:=pos('book',s); {x will be 6}
All this information, and other useful tips you can find here