String Functions

< Show List


x$ + y$

String concatenation.

String concatenation (and the MID$, LEN and INSTR functions) can handle strings of up to 32766 characters in length (if the memory available to the program permits).


chr$(VAL)

Returns the ASCII character corresponding to the value of VAL.


str$( VAL { , EXPR } )

Returns a string representation corresponding to VAL. If EXPR is present then the string is padded to that length.


format$( VAL , STREXPR )

Returns the string representation of VAL formatted according to the format string STREXPR. The format string STREXPR uses the same formatting syntax as the PRINT USING statement.


inkey$

Return one character from the keyboard if input is available. Returns a zero length string { "" } if no keyboard input is available. Non-blocking. Can be used for keyboard polling.


input$( EXPR { , FILENUM } )

Returns EXPR characters from file FILENUM. If f is not present then get input from the console keyboard.


mid$( a$, i { , j } )

Returns a substring of a$ starting at the i'th positions and j characters in length. If the second parameter is not specified then the substring is taken from the start position to the end of a$.


right$(a$, EXPR )

Returns the right EXPR characters of a$.


left$(a$, EXPR )

Returns the left EXPR characters of a$.


field$( STRINGVAL, VAL { , STRINGVAL } )

Returns the N-th field of the first string. If the optional string is present then use the first character of that string as the field separator. The default separator is a space. Similar to UNIX 'awk' fields.

E.g., field$("1 22 333 4", 3) returns "333"

If VAL is -1 then returns a string with a length equal to the number of seperators in the first string.


hex$( VAL { , EXPR } )

bin$( VAL { , EXPR } )

Returns the hexadecimal or binary string representation corresponding to VAL. If EXPR is present then the string is padded with zeros to make it that length.


lcase$( STRINGVAL )

Returns STRINGVAL in all lower case characters.


ucase$( STRINGVAL )

Returns STRINGVAL in all upper case characters.


errorstatus$

Returns the error message for the last error. Prior to any errors, contains Chipmunk Basic version and copyright notice.