Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Futurebasic/Language/Reference/MID statement

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

MID$ and MID$$ Syntax MID$(stringVar$,startPos,numChars) = replaceString$MID$$(container$$,startPos,numChars) = ¬   replaceString$/contnr$$ Revised May 30, 2000 (Release 3) Description This statement updates stringVar$ (which must be a string variable) or container$$ (a container variable), deleting a subpart from stringVar$ or container$$ and replacing it with an equal number of characters from the left side of replaceString$. The subpart to be replaced begins at position startPos within stringVar$ or container$$. In the following code fragments, containers and strings work the same. The number of characters replaced equals the smallest of these quantities: <li type="disc">numChars <li type="disc">LEN(replaceString$) <li type="disc">LEN(stringVar$) - startPos + 1 Under the following circumstances, MID$ does nothing: <li type="disc">When stringVar$ or replaceString$ is empty; <li type="disc">When startPos is less than 1 or greater than LEN(stringVar$); <li type="disc">When numChars is less than 1. Note: You may not use complex expressions that include containers on the right side of the equal sign. Example: x$ = "abcdefgh" y$ = "abcdefgh" z$ = "abcdefgh" MID$(x$,2,3) = "1234" PRINT x$ MID$(y$,2,5) = "1234" PRINT y$ MID$(z$,7,4) = "1234" PRINT z$ program output: a123efgh a1234egh abcdef12 See Also MID$ function; LEFT$; RIGHT$; INSTR