Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Confused about mid() command
#1
Hi Marcus,

I was tinkering with string manipulation and came across a bit of a 'poser' in regards to the mid() command.

Here is a short example....

Code:
' Open a window and enable double buffering.
set window "Test", 800, 632, false
set redraw off

visible a = "ABCDEF"
visible b
visible c

'   display the letters "B" to "E" inclusive...
b = mid(a, 1, 4)
pln b
'   This works fine...

'   But, when I try to make the third letter "D"
'   an "X"...

'   mid(b, 3, 1) = "X"
'   pln b

'   I get a syntax error on line 17 during compile

'(remove the "remarks" from lines 17 and 18
' to see what I mean...)

system "pause"

Defining a string then assigning a variable to a "portion" of the string, using mid(), works fine...
But, trying to replace a character, using mid() causes the compilation to fail with a syntax error.

There is no rush on this one... Whenever you are able... Present situation understood... We will "keep an eye on the store" during your break...

J
Logic is the beginning of wisdom.
Reply


Messages In This Thread
Confused about mid() command - by johnno56 - 06-11-2024, 01:39 AM
RE: Confused about mid() command - by 1micha.elok - 06-11-2024, 10:27 AM
RE: Confused about mid() command - by johnno56 - 06-11-2024, 12:25 PM
RE: Confused about mid() command - by 1micha.elok - 06-12-2024, 09:46 AM
RE: Confused about mid() command - by johnno56 - 06-12-2024, 07:59 PM
RE: Confused about mid() command - by Marcus - 06-14-2024, 01:43 PM
RE: Confused about mid() command - by johnno56 - 06-14-2024, 08:34 PM
RE: Confused about mid() command - by Marcus - 06-15-2024, 08:23 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)