Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:58 05 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Bug in 5.2 string handling

Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10205
Posted: 03:23am 07 Nov 2016
Copy link to clipboard 
Print this post

I've separately copied this to Geoff but be aware passing a composite string to a function where the composite includes the return from a string function will fail

option autorun on
Option explicit
option default NONE
dim s1$="start-"
dim s2$="-end"
dim integer maxtemp=144
dim b$,t$
b$=s1$+outtemp$(maxtemp)+s2$
print b$
sendtext b$ 'this works OK
t$=outtemp$(maxtemp)
sendtext s1$+t$+s2$ 'this works OK
sendText s1$+outtemp$(maxtemp)+s2$ 'this fails
'
function outtemp$(t as integer)
outtemp$=str$(t)
end function
'

sub SendText(a$)
local c$
c$=STR$(len(a$))
print c$
end sub


  Quote  RUN
start-144-end
13
13
[22] c$=Str$(Len(a$))
Error: A not declared
>
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025