Available on: all targets See also: LEFT (function) LEFT MID (function) RIGHT (function) RIGHT LEN ✓ verified

MID

The MID statement allows to change a (dynamic) string containing a specified number of characters from a string. It has three parameters.

The first parameter is the string expression to modify.

The second parameter is the character position in string at which the part to be taken begins. If start is greater than the number of characters in string, MID replace at the end of the string.

The third parameter is optional, and gives the number of characters to replace. If omitted or if there are fewer than length characters in the text (including the character at start), all characters from the start position to the end of the string are replaced.

SYNTAX

 MID( text, position[, len] ) = value


Legend
  • id : identifier
  • type : datatype
  • v : value
  • "..." : string
  • [...] : optional

EXAMPLE

  a$ = "PUNTO": MID( a$, 1, 3 ) = "PON": PRINT a$: REM prints "PONTO"


Used in:

ABBREVIATION: Mi

Join BASIC 10Liner Contest with ugBASIC!

An interesting competition is held at the beginning of each year: the BASIC 10Liner Contest. It is possible to use ugBASIC to participate in the next "BASIC10Liner" competition, in the following categories:

  • PUR-120 - A game in 10 lines of max 120 characters (w/abbrev.)
  • EXTREME-256 - A game in 10 lines of max 256 characters (w/abbrev.)
  • SCHAU - Any program in 10 lines of max 256 characters (w/abbrev.)
In order to reduce space you can use this abbreviation for this instruction:

MID ↔ Mi

Any problem?

If you have found a problem with this keyword, if you think there is a bug or, more simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!

open an issue BACK TO KEYWORDS