Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Strings, Unsafe code, is C# really any use to a VB programmer?

2 views
Skip to first unread message

Joe "Nuke Me Xemu" Foster

unread,
Feb 28, 2002, 12:58:13 PM2/28/02
to
"Richard Curzon" <s...@interNOSPAMlog.com> wrote in message <news:#s7kDc27AHA.2016@tkmsftngp03>...

> Thanks for the feedback. And sorry for the delay, you still there" <g>.

Top /this/ delay! (Guess I'd better mail this too...)

> Before I raised the original question I had built a QuickString class in VB
> for building blocks of HTML with easy to use syntax. Primarily the
> performance bottleneck I ran into seems to be the performance of Mid$.
> Regardless of whether you've allocated space in your string for your current
> operations, Mid$ doesn't trust you and checks anyway.

Oh, stop whingeing about Mid$ and simply paste this into a module
to live fast, die young, and leave a beautiful crash...

' Macho, macho Mid$! I've got to be, a macho Mid$!
Property Let MachoMid(ByRef String1 As String, ByVal Start As Long, ByVal Length As Long, ByRef String2 As String)
RtlMoveMemory ByVal StrPtr(String1) + 2 * Start - 2, ByVal StrPtr(String2), Length * 2
End Property

' I have absolutely no idea whatsoever if this actually is faster than Mid$
Property Get MachoMid$(ByRef String1 As String, ByVal Start As Long, ByVal Length As Long)
MachoMid = Space$(Length) ' Try the BSTR API to get a raw string buffer?
RtlMoveMemory ByVal StrPtr(MachoMid), ByVal StrPtr(String1) + 2 * Start - 2, Length * 2
End Property

(Moo hoo hah ha...!)

--
Joe Foster <mailto:jlfoster%40znet.com> Wanna buy a Bridge? <http://xenu.net/>
WARNING: I cannot be held responsible for the above They're coming to
because my cats have apparently learned to type. take me away, ha ha!


0 new messages