How to pass a string variable to procedure as parameter?

Started by trastikata, Today at 05:56 PM

Previous topic - Next topic

trastikata

Hello,

I have a particular case that I can't resolve. I want to pass a String variable to procedure as parameter, something like:

Dim myString2 As String * 15
Dim myString1 As String * 24

WorkWithString(myString1)
End

Proc WorkWithString(--> here the String Variable comes As parameter <--)

EndProc

I was thinking of using "ByRef" and then work with the String as a byte array, but then I can't estimate the input strings' size by using "Bound(sString)", the final code should be the equivalent of:

Dim myString1 As String * 24
Dim myString2 As String * 15

    WorkWithString(myString1)
End


Proc WorkWithString(--> here the String Variable comes As parameter, name it "sString" <--)
    Dim bCounter As Byte
   
    bCounter = 5
    Do
        'For illustration purposes
        sString[bCounter] = sString[bCounter + 1]
        Inc bCounter
    Loop While bCounter < Bound(sString)   
EndProc