Search string
Posted: Thu Mar 13, 2025 1:26 pm
Why doesn't the code work? Two lines should display:
1. Hello all
2. Thiis is not work
1. Hello all
2. Thiis is not work
Code: Select all
Define string$
Define *buffer
Define data_label.s
Define i.i
Define char_label.c
Define label_text.s
string$=lf$+"Hello all #"+lf$+" this is Not work#"+lf$
*Buffer = UTF8(string$)
data_label=PeekS(*buffer,-1,#PB_UTF8)
Repeat
Last = Position
Position = FindString(data_label , "#", Position + 1)
If Position > 0
Debug "':' found at position: " + Position
For i = position To 1 Step -1
char_label= Asc(Mid(data_label,i, 1))
If char_label<>#LF Or char_label<>#CR
label_text=label_text+Chr(char_label)
ElseIf char_label=#LF Or char_label=#CR
label_text=""
EndIf
Next i
Debug "label_text:" + ReverseString(label_text)
label_text=""
EndIf
Until Not Position