On 08/04/2022 09:07, desin via Ql-Users wrote:
Hi all
how can we use instr_case in a Qliberated program ?
At present you cant. If you use the latest Qlib (V3.45) youll even get
a warning message. It wont work in Turbo either.
There was a discussion about this on QL forum (see
https://www.qlforum.co.uk/viewtopic.php?f=3&t=3166&hilit=instr_case&start=30)
The main reason, I believe, is that INSTR_CASE is a global setting and
so shouldnt be set by a program, but only by the user in the main console.
You could use a toolkit command instead, such as Knoware's INSTR%()
function in the Str3TK toolkit, which allows for both a case dependent
and case-agnostic INSTR. See www.Knoware.no/htm/toolkits.htm#strings.
100 CLEAR
110 a%= FOPEN ("con")
120 OUTL
130 OUTL #a%,500,200,0,30
140 WINDOW#a%,500,200,0,30
150 CLS#a%
160 :
170 a$ = "hello" : b$ = "Hello": c$ = "hELLO"
180 :
190 PRINT#a%
200 PRINT#a%,,"instr_case truth table "
210 PRINT#a%
220 :
230 INSTR_CASE 1
240 PRINT#a%,,"instr_case 1"
250 PRINT#a%
260 PRINT#a%,, a$,a$,a$ INSTR a$
270 PRINT#a%,, b$,b$,b$ INSTR b$
280 PRINT#a%,, a$,b$,a$ INSTR b$
290 PRINT#a%,, b$,a$,b$ INSTR a$
300 PRINT#a%,, b$,c$,b$ INSTR c$
310 PRINT#a%,, c$,a$,c$ INSTR a$
320 PAUSE#a%
330 CLS#a%
340 CLOSE#a%
Greetings from Switzerland
Markus
Per
_______________________________________________
QL-Users Mailing List