- التعامل مع سلسلة الحروف
1- بحث واخذ القطعة المتبقية
- التعامل مع سلسلة الحروف
1- بحث واخذ القطعة المتبقية
تم تعديل هذه المشاركة بواسطة زكيري عبد العالي في 18 أغسطس 2008 في 14:27
*- كود لقلب سلسله رموز
zekiri--> irikez
[color= #000000; font-weight: bold;]function Reverse[color= #009900;](input[color= #339933;]:string [color= #009900;])[color= #339933;]: string[color= #339933;]; [color= #000000; font-weight: bold;]var inputArray [color= #339933;]: [color= #990000;]array of char[color= #339933;]; begin SetLength[color= #009900;](inputArray[color= #339933;],input[color= #339933;].Length[color= #009900;])[color= #339933;]; inputArray [color= #339933;]:= input[color= #339933;].ToCharArray[color= #009900;]([color= #009900;])[color= #339933;]; [color= #339933;]&Array[color= #339933;].Reverse[color= #009900;](inputArray[color= #009900;])[color= #339933;]; result[color= #339933;]:=inputArray[color= #339933;]; [color= #990000;]end[color= #339933;];
showmessage(Reverse('ZEKIRI'));2-بحث واخذ الفطعة المتبقية
مثل ماتفعله الوظيفة copyفي الدلفي العادي
[color= #000000; font-weight: bold;]function [color= #990000;]Strstr[color= #009900;](haystack[color= #339933;],needle[color= #339933;]:string[color= #009900;])[color= #339933;]:string[color= #339933;]; [color= #000000; font-weight: bold;]var firstIndex [color= #339933;]:integer[color= #339933;]; begin firstIndex [color= #339933;]:= haystack[color= #339933;].IndexOf[color= #009900;](needle[color= #009900;])[color= #339933;]; result[color= #339933;]:= haystack[color= #339933;].Substring[color= #009900;](firstIndex[color= #009900;])[color= #339933;]; [color= #990000;]end[color= #339933;];
سؤال أخي زكيري :
ما فائدة رمز & في الكود الأول (كود الدالة Revers , السطر 7) ؟
اقتباسIf A is success in life, then A equals x plus y plus z. Work is x; y is play; and z is keeping your mouth shut
Albert Einstein
السلام عليكم
مشكور اخي Delphawi على هذه المشاركة اتمنئ لك التوفيق في الدلفي نت
ما فائدة رمز &
هو يعوض T في الدلفي العادي حيث كنا نكتبT???? مثلا Tstrings وهو الكلاس فقط او النوع .
شكرا