Announcement

Collapse

Documentation

All current versions of the PowerBASIC documentation are available for download/viewing here:

PowerBASIC Links
See more
See less

MID$ statement where replacement text is not same length as replaced text

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MID$ statement where replacement text is not same length as replaced text

    Help for the statement form of MID$ says:
    If Count& is omitted, or there aren't enough characters in StringVar, all remaining characters are replaced.
    ...
    The replacement will never extend past the end of StringVar. In other words, MID$ cannot alter the length of a string.

    While that is quite clear, it doesn't describe the case where the replacement string is shorter than the number of characters to replace
    e.g
    Code:
    strT = "ABCDEFGH"
    Mid$(strT,1,5) = "XYZ"
    In this situation, the bold statment above still applies.
    e.g.
    The result of the code above is
    "XYZCDEFGH" and not the shorter sting "XYZEFGH"



Working...
X