Built-in functions from the insert · Fonctions intégrées de l'insertion
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · Cette page nécessite un navigateur récent (avec support SharedArrayBuffer). Veuillez mettre à jour Chrome, Edge, Firefox ou Safari vers la dernière version.
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.
Français
Un reçu joint un nombre à du texte
- Chaque Paper 2 contient une annexe de fonctions intégrées. Tout ce qui n'est pas dans le guide de pseudocode y est imprimé, et une réponse peut l'utiliser.
LEFT(Text, N)copie les premiersNcaractères. Les positions commencent toujours à 1.NUM_TO_STR(87.5)est la chaîne"87.5". Joignez-la avec&quand la ligne doit contenir des mots et un nombre.
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.
Français
Vérifier avant de convertir
IS_NUM(Text)est vraiTRUEseulement si la chaîne représente un nombre."12a"est vraiFALSE.STR_TO_NUM("23")est le nombre23, donc vous pouvez lui ajouter 1. Une chaîne ne peut pas être additionnée.- Convertissez seulement après que
IS_NUMa confirmé que le texte est sûr.
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).
Français
ASC et CHR
ASC("A")est le code entier65.CHR(66)est le caractère"B".- La lettre suivante après
"A"estCHR(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.
Français
Erreurs courantes
UCASEprend toujours un seul caractère. Une chaîne entière en majuscules estTO_UPPER, que vous avez vue précédemment.NUM_TO_STRretourne du texte.STR_TO_NUMretourne un nombre. Ils ne sont pas interchangeables.
English
Now you try
- Use
LEFT, then a joined number, thenIS_NUMbefore a conversion.
Français
À vous maintenant
- Utilisez
LEFT, puis un nombre joint, puisIS_NUMavant une conversion.
Output · Sortie LEFT("Computer", 3). · Affichez LEFT("Computer", 3).
Click Run to see the output here. · Cliquez sur Exécuter pour voir le résultat ici.
Output · Sortie Score: 87.5 on one line by joining the word and NUM_TO_STR(87.5) with &. · Affichez Score: 87.5 sur une ligne en joignant le mot et NUM_TO_STR(87.5) avec &.
Click Run to see the output here. · Cliquez sur Exécuter pour voir le résultat ici.
Text is "23". If IS_NUM(Text), output STR_TO_NUM(Text) + 1. Otherwise output bad. · Text est "23". Si IS_NUM(Text), affichez STR_TO_NUM(Text) + 1. Sinon affichez bad.
Click Run to see the output here. · Cliquez sur Exécuter pour voir le résultat ici.