Built-in functions from the insert · Funciones integradas del insert
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · Esta página necesita un navegador reciente (con soporte para SharedArrayBuffer). Por favor, actualiza Chrome, Edge, Firefox o Safari a la última versión.
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.
Español
Un recibo une un número con texto
- Cada Paper 2 tiene una inserción de funciones integradas. Todo lo que no está en la guía de pseudocódigo se imprime allí, y una respuesta puede utilizarlo.
LEFT(Text, N)copia los primerosNcaracteres. Las posiciones siguen comenzando en 1.NUM_TO_STR(87.5)es la cadena"87.5". Úsela con&cuando la línea deba contener palabras y un número.
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.
Español
Verifique antes de convertir
IS_NUM(Text)esTRUEsolo si la cadena es un número."12a"esFALSE.STR_TO_NUM("23")es el número23, por lo que se le puede sumar 1. Una cadena no se puede sumar.- Convierta solo después de que
IS_NUMindique que el texto es seguro.
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).
Español
ASC y CHR
ASC("A")es el código entero65.CHR(66)es el carácter"B".- La siguiente letra después de
"A"esCHR(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.
Español
Errores comunes
UCASEaún toma un solo carácter. Una cadena completa en mayúsculas esTO_UPPER, que ya conoció anteriormente.NUM_TO_STRdevuelve texto.STR_TO_NUMdevuelve un número. No son intercambiables.
English
Now you try
- Use
LEFT, then a joined number, thenIS_NUMbefore a conversion.
Español
Ahora intente usted
- Utilice
LEFT, luego un número concatenado, yIS_NUMantes de una conversión.
Output · Salida LEFT("Computer", 3). · Emite LEFT("Computer", 3).
Click Run to see the output here. · Haz clic en Ejecutar para ver la salida aquí.
Output · Salida Score: 87.5 on one line by joining the word and NUM_TO_STR(87.5) with &. · Emite Score: 87.5 en una línea uniendo la palabra y NUM_TO_STR(87.5) con &.
Click Run to see the output here. · Haz clic en Ejecutar para ver la salida aquí.
Text is "23". If IS_NUM(Text), output STR_TO_NUM(Text) + 1. Otherwise output bad. · Text es "23". Si IS_NUM(Text), emite STR_TO_NUM(Text) + 1. De lo contrario emite bad.
Click Run to see the output here. · Haz clic en Ejecutar para ver la salida aquí.