11-06-2018, 01:13 AM
11-06-2018, 05:53 AM
وعليكم السلام
هكذا
هكذا
PHP كود :
if s <> '' then
// يحتوي على حروف
أو
if Length(s) > 0 then
// يحتوي على حروف
11-06-2018, 07:10 PM
(11-06-2018, 05:53 AM)Agmcz كتب : [ -> ]وعليكم السلام
هكذا
PHP كود :if s <> '' then
// يحتوي على حروف
أو
if Length(s) > 0 then
// يحتوي على حروف
هكذا يتحقق اذا كان السترنغ فارغ ام لا
المطلوب هو اذا كان يحتوي حروف عربي وليس ارقام
11-06-2018, 07:24 PM
PHP كود :
procedure TForm1.Button1Click(Sender: TObject);
const
AUCTable: array [0 .. 49] of Word = ($0621, $0622, $0623, $0624, $0625, $0626,
$0627, $0628, $0629, $062A, $062B, $062C, $062D, $062E, $062F, $0630, $0631,
$0632, $0633, $0634, $0635, $0636, $0637, $0638, $0639, $063A, $063B, $063C,
$063D, $063E, $063F, $0640, $0641, $0642, $0643, $0644, $0645, $0646, $0647,
$0648, $0649, $064A, $064B, $064C, $064D, $064E, $064F, $0650,
$0651, $0652);
var
i: integer;
Str: String;
begin
Str := 'dfg تجريب dfg4df4gd44 dfg';
for i := Low(AUCTable) to High(AUCTable) do
begin
if Pos(WideChar(AUCTable[i]), Str) > 0 then
begin
ShowMessage('Arabic letters detected :)');
Break;
end;
end;
end;
جدول اليونيكود ماخود من موضوع Agmcz من هنا
PHP كود :
http://delphi4arab.net/forum/showthread.php?tid=9475
11-06-2018, 07:43 PM
(11-06-2018, 07:24 PM)AX302 كتب : [ -> ]PHP كود :procedure TForm1.Button1Click(Sender: TObject);
const
AUCTable: array [0 .. 49] of Word = ($0621, $0622, $0623, $0624, $0625, $0626,
$0627, $0628, $0629, $062A, $062B, $062C, $062D, $062E, $062F, $0630, $0631,
$0632, $0633, $0634, $0635, $0636, $0637, $0638, $0639, $063A, $063B, $063C,
$063D, $063E, $063F, $0640, $0641, $0642, $0643, $0644, $0645, $0646, $0647,
$0648, $0649, $064A, $064B, $064C, $064D, $064E, $064F, $0650,
$0651, $0652);
var
i: integer;
Str: String;
begin
Str := 'dfg تجريب dfg4df4gd44 dfg';
for i := Low(AUCTable) to High(AUCTable) do
begin
if Pos(WideChar(AUCTable[i]), Str) > 0 then
begin
ShowMessage('Arabic letters detected :)');
Break;
end;
end;
end;
جدول اليونيكود ماخود من موضوع Agmcz من هنا
PHP كود :http://delphi4arab.net/forum/showthread.php?tid=9475
توضيح اكتر اذا كان السترنغ يحتوي رقم لايتم التنفيد واذا كان يحتوي حروف يتم تنفيذ الشرط هذا المطلوب
11-06-2018, 07:51 PM
تحقق من انه يحتوي فقط على ارقام
function CheckNumber(const s: string): Boolean;
begin
Result := True;
try
StrToInt(s);
except
Result := False;
end;
end;
function CheckNumber(const s: string): Boolean;
begin
Result := True;
try
StrToInt(s);
except
Result := False;
end;
end;
12-06-2018, 12:29 AM
PHP كود :
var
s: String;
iValue, iCode: Integer;
...
val(s, iValue, iCode);
if iCode = 0 then
ShowMessage('s has a number')
else
ShowMessage('s has not a number');
PHP كود :
function TryDecimalStrToInt( const S: string; out Value: Integer): Boolean;
begin
result := ( pos( '$', S ) = 0 ) and TryStrToInt( S, Value );
end;
PHP كود :
function IsNumber(N : String) : Boolean;
var
I : Integer;
begin
Result := True;
if Trim(N) = '' then
Exit(False);
if (Length(Trim(N)) > 1) and (Trim(N)[1] = '0') then
Exit(False);
for I := 1 to Length(N) do
begin
if not (N[I] in ['0'..'9']) then
begin
Result := False;
Break;
end;
end;