Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Function to edit a string (*solved*)
#4
No, it doesn't seem to work. See example - the function won't edit the string:
Code:
DIM a$ AS String

FUNCTION editStringFN(ByREF stringToEdit$ AS String, pos AS Integer, newLetter$ AS String) AS String
    stringToEdit$(pos)=newLetter$
    PRINT AT 10,0; stringToEdit$
    RETURN stringToEdit$
END FUNCTION

CLS
a$="sample"
PRINT a$; "- original string"

'try to edit string via the function
a$=editStringFN(a$, 1, "i")
PRINT AT 1,0;a$; "- function fails to edit"

'same edit without using the function
a$(1)="i"
PRINT a$; "- works as regular code"
Reply


Messages In This Thread
Function to edit a string (*solved*) - by patters - 2020-12-29, 06:13 PM
RE: Function to edit a string - by patters - 2020-12-29, 07:37 PM
RE: Function to edit a string - by boriel - 2020-12-30, 09:26 AM
RE: Function to edit a string - by patters - 2020-12-30, 01:14 PM
RE: Function to edit a string - by boriel - 2020-12-30, 07:01 PM
RE: Function to edit a string - by boriel - 2021-01-02, 03:14 PM
RE: Function to edit a string - by patters - 2021-01-02, 08:35 PM
RE: Function to edit a string - by patters - 2021-01-03, 01:44 AM
RE: Function to edit a string - by boriel - 2021-01-03, 06:03 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)