I am trying to implement the FORMAT$ function, and i have this code:
for i = 1 to len(f)
select case mid(f, i, 1)
case ","
commas = 1
case "."
decimal = 1
case "0"
if decimal = 0 then
lzeroes += 1
else
tzeroes += 1
end if
end select
print ">>>" & mid(f, i, 1) & "-" & str(decimal)
next
But one of the message boxes displays: ">>>.-0"
This can only mean that either the "." is not being detected, or that i have no idea how select case works on Oxygen.
A little help?
Use asc instead:
select asc(f,i)
or better still:
byte bb at strptr(f)-1
for i = 1 to len(f)
select bb[ i ]
...
Ok, But if i am going to emulate it, i need to know why the other method doesnt work.
Not only that, i need to know how to make it work.
Can you show me an example of it with strings?
Case blocks only work on numbers. They are very primitive, but as efficient as pure Assembler, more so than using 'if' statatements.
BTW:
case "0" :
is converted to:
case 48 :
No problem, i will convert oxygen's SELECT CASE blocks to IF statements. Its a simple switch in pluribasic. :)
So, no need to edit them in your code, they will work as normal today.
Edit:
Done, oxygen now supports select case blocks with strings in PluriBASIC.
Numeric blocks will still have the SELECT CASE syntax, but string ones are now IF blocks.