Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
lpstr problems
#13
Maybe faster, maybe not.

Macro Macro2739
Code:
Copy      Help
out

str texte=
;Hi gintaras, hi all
;Gintaras, i mess with some lpstr functions (my fault, not QM one of course)
;The problem is that the lpstr seems not be reinitialized correctly in my code.
;I'm aware that a lpstr can be set to null by lpstr s=0, but it seems to be an issue in new OS's about "nullification" (nullptr comes to mind, and seems not yet implemented in QM)
;The general code i use for that is to declare an unitialized lpstr and make the used one equal it.
;lpstr s="some text"
;lpstr f
;//code
;....
;//code
;s=f
;Is there a better way?
;2.
;str f.lpstr="some text"
;is using this as fast as using a general lpstr? I ask that because using pointers is usually more efficient than direct str manipulation.
;Thanks for your patience !!

str dict=
;lpstr,Lpstr
;code,Code
;is,Island
;the T
;fast,Faster
;more,More

sub.RemplaceMotsRX dict texte
out texte


#sub RemplaceMotsRX
function $dict ~&texte

IStringMap m._create
m.Flags=1|2
m.AddList(dict "csv")

REPLACERX r.frepl=&sub.Callback_str_replacerx; r.paramr=&m
texte.replacerx("\b\w+\b" r 1)


#sub Callback_str_replacerx
function# REPLACERXCB&x

;out x.match
IStringMap& m=+x.rrx.paramr
lpstr k=m.Get(x.match)
if(k) x.match=k


Messages In This Thread

Forum Jump:


Users browsing this thread: 11 Guest(s)