Built-in functions from the insert · دوال مدمجة من الإدراج
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · تحتاج هذه الصفحة إلى متصفح حديث (يدعم SharedArrayBuffer). يرجى تحديث Chrome أو Edge أو Firefox أو Safari إلى أحدث إصدار.
English
A receipt joins a number to text
- Every Paper 2 has an insert of built-in functions. Anything not in the pseudocode guide is printed there, and an answer may call it.
LEFT(Text, N)copies the firstNcharacters. Positions still start at 1.NUM_TO_STR(87.5)is the string"87.5". Join it with&when the line must contain words and a number.
العربية
إيصال يربط رقماً بنص
- كل ورقة 2 تحتوي على ملحق بدوال مدمجة. أي شيء غير موجود في دليل الخوارزمية الزائفة يُطبع هناك، وقد تستدعيه الإجابة.
LEFT(Text, N)ينسخ أولNأحرف. لا تزال المواقع تبدأ من 1.NUM_TO_STR(87.5)هو المتغير النصي"87.5". اربطه مع&عندما يجب أن يحتوي السطر على كلمات ورقم.
OUTPUT LEFT("Computer", 3)
OUTPUT "Score: " & NUM_TO_STR(87.5)
English
Check before you convert
IS_NUM(Text)isTRUEonly when the string is a number."12a"isFALSE.STR_TO_NUM("23")is the number23, so you can add 1 to it. A string cannot be added.- Convert only after
IS_NUMsays the text is safe.
العربية
تحقق قبل التحويل
IS_NUM(Text)هوTRUEفقط عندما يكون النص رقماً."12a"هوFALSE.STR_TO_NUM("23")هو الرقم23، لذا يمكنك إضافة 1 إليه. لا يمكن إضافة نص.- حول فقط بعد أن يؤكد
IS_NUMأن النص آمن.
DECLARE Text : STRING
Text ← "23"
IF IS_NUM(Text) THEN
OUTPUT STR_TO_NUM(Text) + 1
ELSE
OUTPUT "bad"
ENDIF
English
ASC and CHR
ASC("A")is the integer code65.CHR(66)is the character"B".- The next letter after
"A"isCHR(ASC("A") + 1).
العربية
ASC و CHR
ASC("A")هو الكود الصحيح للرقم65.CHR(66)هو الحرف"B".- الحرف الذي يلي
"A"هوCHR(ASC("A") + 1).
OUTPUT CHR(ASC("A") + 1)
OUTPUT IS_NUM("12a")
English
Common mistakes
UCASEstill takes one character. A whole string in capitals isTO_UPPER, which you met earlier.NUM_TO_STRreturns text.STR_TO_NUMreturns a number. They are not interchangeable.
العربية
أخطاء شائعة
- لا يزال
UCASEيأخذ حرفًا واحدًا. السلسلة النصية الكاملة بالأحرف الكبيرة هيTO_UPPER، والتي واجهتها سابقًا. NUM_TO_STRيعيد نصاً.STR_TO_NUMيعيد رقماً. هما ليسا قابلين للتبديل.
English
Now you try
- Use
LEFT, then a joined number, thenIS_NUMbefore a conversion.
العربية
الآن جرب بنفسك
- استخدم
LEFT، ثم رقماً مُربَطاً، ثمIS_NUMقبل التحويل.
Output LEFT("Computer", 3). · أخرج LEFT("Computer", 3).
Click Run to see the output here. · اضغط تشغيل لرؤية المخرجات هنا.
Output Score: 87.5 on one line by joining the word and NUM_TO_STR(87.5) with &. · أخرج Score: 87.5 في سطر واحد بربط الكلمة وNUM_TO_STR(87.5) باستخدام &.
Click Run to see the output here. · اضغط تشغيل لرؤية المخرجات هنا.
Text is "23". If IS_NUM(Text), output STR_TO_NUM(Text) + 1. Otherwise output bad. · Text هو "23". إذا IS_NUM(Text)، أخرج STR_TO_NUM(Text) + 1. وإلا أخرج bad.
Click Run to see the output here. · اضغط تشغيل لرؤية المخرجات هنا.