Juergen
what class did you take into account CWSTR or DWSTR ?
with DWSTR, if i test with your modified fbc:
Right / Left native functions without my own overloaded functions i still need to dereferrence
trim and all variation still need to dereferrence
mid seems to work correctly without dereferrencing
'compile with console to view the information
' windows_test_1_dwstr.bas : to test under windows the DWSTR (dynamic Wstring) class
'########################################################################
'this test code assume you are using a system codepage : 1252
' the literal inputs are dependant of that codepage,
' except utf8 inputs which are codepage independant
'########################################################################
#PRAGMA DWS
#DEFINE UNICODE ' needed to messagebox only : to use wstring not string
#INCLUDE ONCE "DWSTR.inc" 'DWSTR class
#Include Once "crt/time.bi" 'just to measure the speed
scope 'interesting to check the destructor action on debugg mode
print : print "testing last DWSTR.inc "
DIM cws AS DWSTR = Dw_Wstr( " Êàêèå-òî êðàêîçÿáðû " , 1251)
messagebox(0, cws, "test len =" & len(cws), 0)
messagebox(0, mid(cws,5), "mid(cws,5) len =" & len(mid(cws,5)), 0)
cws = trim(cws)
messagebox(0, cws, "test len =" & len(cws), 0)
messagebox(0, mid(cws,5), "mid(cws,5) len =" & len(mid(cws,5)), 0)
dim dw1 as dwstr = dw_string(23 , &h1D11E)
messagebox(0 , dw1 & wstr( " dw_Len ") & wstr(Dw_Len(dw1)) , "test capacity " & wstr(dw1.capacity) , 0)
messagebox(0 , dw1 & wstr( " SurPair ") & wstr(dw1.Sur_Count) , "test capacity " & wstr(dw1.capacity) , 0)
dw1.replace( "_it's a test of replacing text " , 21)
messagebox(0 , dw1 & wstr( " dw_Len ") & wstr(Dw_Len(dw1)) , "capacity " & wstr(dw1.capacity) , 0)
messagebox(0 , "Sur_Count = " & dw1.Sur_Count & " nb of surrogate pair " , "len =" & len(dw1) & " dw_len =" & Dw_Len(dw1), 0)
dim dw4 as dwstr = mid(dw1, 9, 4)
messagebox(0 , ">" & dw4 & "< len = " & len(dw4) & " dw_len = " & dw_len(dw4), "test mid as wstring only" , 0)
DIM bs2 AS dwstr = dw_wstr( "ДмиÌтрий ДмиÌтриевич" , CP_UTF8)
messagebox 0 , bs2 , "test dw_wstr CP_UTF8" , MB_OK
messagebox 0 , mid(bs2,5) , "test mid" , MB_OK
dim z1 as double
dim z2 as double
dim n as long = 1000000
PRINT : PRINT
print : print "Press key to continue !"
sleep
dim as string st1
dim as string sText = "verif : "
dim as DWSTR uws, uws0,uws1,uws2
dim as DWSTR uwsText = "verif : "
dim x as long
print : print
print "=========================================="
print " Comparaison DWSTR Solutions : concatenation"
print "==========================================" : print
z1 = clock()
for x = 1 to n
st1 += "Line " & n & ", Column " & n & ": " & sText '& sText2
NEXT
z2 = clock()
print : print "STRING using &" : print right(st1, 38) + " time = " + str(z2 - z1) + " ms len = " & len(st1): print
print mid(st1, 37999962) + " mid ": print
print "==========================================" : print
z1 = clock()
for x = 1 to n
uws += "Line " + WSTR(n) + ", Column " + WSTR(n) + ": " + *uwsText
NEXT
z2 = clock()
print : print "DWSTR dereferenced using + " : print right(uws,38) + " time = " + str(z2 - z1) + " ms len = " & len(uws): print
print mid(uws, 37999962) + " mid ": print
z1 = clock()
for x = 1 to n
uws0 += "Line " + WSTR(n) + ", Column " + WSTR(n) + ": " & *uwsText
NEXT
z2 = clock()
print : print "DWSTR dereferenced using & " : print right(uws0,38) + " time = " + str(z2 - z1) + " ms len = " & len(uws0): print
print mid(uws0, 37999962) + " mid ": print
z1 = clock()
for x = 1 to n
uws1 += "Line " + WSTR(n) + ", Column " + WSTR(n) + ": " + uwsText
NEXT
z2 = clock()
print : print "DWSTR not dereferenced using + " : print right(uws1,38) + " time = " + str(z2 - z1) + " ms len = " & len(uws1): print
print mid(uws1, 37999962) + " mid ": print
z1 = clock()
for x = 1 to n
uws2 += "Line " + WSTR(n) + ", Column " + WSTR(n) + ": " & uwsText
NEXT
z2 = clock()
print : print "DWSTR not dereferenced using & new overloaded operator " : print right(uws2, 38) + " time = " + str(z2 - z1) + " ms len = " & len(uws2): print
print mid(uws2, 37999962) + " mid " : print : print
print : print
end scope
print : print "Press key to finish !"
sleep
could you post somewhere (better github) your evolution of fbc?