langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
74
Task/Classes/OxygenBasic/classes.oxy
Normal file
74
Task/Classes/OxygenBasic/classes.oxy
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
class SuperString
|
||||
|
||||
indexbase 1
|
||||
|
||||
union
|
||||
bstring s
|
||||
sys bs
|
||||
sys *y
|
||||
int *i
|
||||
byte *b
|
||||
float *f
|
||||
end union
|
||||
|
||||
method space(sys n)
|
||||
s=space n
|
||||
end method
|
||||
|
||||
method delete()
|
||||
freememory bs : bs=0
|
||||
end method
|
||||
|
||||
method clear()
|
||||
sys j, le=length
|
||||
if le then
|
||||
for j=1 to le : b[j]=0 : next
|
||||
end if
|
||||
end method
|
||||
|
||||
method length() as sys
|
||||
if bs then return i[0]
|
||||
end method
|
||||
|
||||
method resize(sys n)
|
||||
sys le=length
|
||||
if n<le
|
||||
s=left s,n
|
||||
elseif n>le
|
||||
s+=nuls n-le
|
||||
end if
|
||||
end method
|
||||
|
||||
method fill(string f)
|
||||
sys j, ls=length, lf=len f
|
||||
for j=1 to ls step lf
|
||||
mid s,j,f
|
||||
next
|
||||
end method
|
||||
|
||||
method constructor()
|
||||
end method
|
||||
|
||||
method destructor
|
||||
delete
|
||||
end method
|
||||
|
||||
end class
|
||||
|
||||
|
||||
'#recordof SuperString
|
||||
|
||||
'=====
|
||||
'TESTS
|
||||
'=====
|
||||
|
||||
new SuperString ss
|
||||
'
|
||||
ss.space 100
|
||||
ss.resize 8
|
||||
ss.fill "abc"
|
||||
'
|
||||
print ss.s 'result abcabcab
|
||||
print ss.b[3] 'result 99: ascii for 'c'
|
||||
'
|
||||
del ss
|
||||
Loading…
Add table
Add a link
Reference in a new issue