Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #11134

Re: VbScript and .NET objects

From "Mayayana" <mayayana@invalid.nospam>
Newsgroups microsoft.public.scripting.vbscript
Subject Re: VbScript and .NET objects
Date 2015-08-30 12:55 -0400
Organization A noiseless patient Spider
Message-ID <mrvc7v$d91$1@dont-email.me> (permalink)
References <55e1a84f.4061562@nntp.aioe.org> <mrsftt$lp0$1@dont-email.me> <mrsgqv$p51$1@dont-email.me> <mrvamc$6es$1@dont-email.me>

Show all headers | View raw


| > Pt1 = Instr(1, s2, "apple", 0)
| > s3 = Mid(s, Pt1, 5)
| > s3 then returns apple, Apple, APPLE, etc.
| >
| >   The non-case sensitive version of Instr has to
| > do a more complex search. The binary version
| > just needs to look for a matching byte value.
|
| How does one implement this in VBS w/o the Mid() function?<g>
|

  I'm not sure I get that. Are you referring
to my comment about missing the Mid statement
in VBS? As a VBer I expect you probably know
the difference between the Mid statement
and the Mid function. Did I miss something?

  For those who don't know, the Mid statement
can be used to build strings in VB:

Replaces characters in s1, starting with offset 101:

Mid(s1, 101) = "sample"

  It's very efficient because it doesn't require
memory allocation. It just writes the data
directly into the string variable memory. The
equivalent in VBS is something like:

s2 = Left(s1, 100)
s3 = Right(s1, Len(s1) - 106)
s1 = s2 & "sample" & s3

  Three new string allocations. s2, s3 and a
new allocation for s1. Very sloppy and very
slow. Like binary operations, the Mid statment
is a glaring omission in VBS. But using an array
as a string builder comes close to the efficiency
of Mid. 

Back to microsoft.public.scripting.vbscript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

VbScript and .NET objects noone@no.void (Reventlov) - 2015-08-29 12:40 +0000
  Re: VbScript and .NET objects "Mayayana" <mayayana@invalid.nospam> - 2015-08-29 10:39 -0400
    Re: VbScript and .NET objects "Mayayana" <mayayana@invalid.nospam> - 2015-08-29 10:55 -0400
      Re: VbScript and .NET objects GS <gs@v.invalid> - 2015-08-30 12:25 -0400
        Re: VbScript and .NET objects "Mayayana" <mayayana@invalid.nospam> - 2015-08-30 12:55 -0400
          Re: VbScript and .NET objects GS <gs@v.invalid> - 2015-08-30 13:02 -0400
            Re: VbScript and .NET objects GS <gs@v.invalid> - 2015-08-30 13:10 -0400
              Re: VbScript and .NET objects "Mayayana" <mayayana@invalid.nospam> - 2015-08-30 13:42 -0400
                Re: VbScript and .NET objects GS <gs@v.invalid> - 2015-08-30 14:04 -0400
                Re: VbScript and .NET objects "Mayayana" <mayayana@invalid.nospam> - 2015-08-30 17:05 -0400
                Re: VbScript and .NET objects GS <gs@v.invalid> - 2015-08-30 17:14 -0400
          Re: VbScript and .NET objects "Dave \"Crash\" Dummy" <invalid@invalid.invalid> - 2015-08-30 21:45 -0400
            Re: VbScript and .NET objects "Mayayana" <mayayana@invalid.nospam> - 2015-08-30 23:09 -0400
              Re: VbScript and .NET objects "Dave \"Crash\" Dummy" <invalid@invalid.invalid> - 2015-08-31 07:40 -0400
                Re: VbScript and .NET objects "Mayayana" <mayayana@invalid.nospam> - 2015-08-31 09:50 -0400
    Re: VbScript and .NET objects johnbeschler@gmail.com - 2017-03-15 10:24 -0700
      Re: VbScript and .NET objects "Mayayana" <mayayana@invalid.nospam> - 2017-03-15 14:40 -0400
        Re: VbScript and .NET objects "Mayayana" <mayayana@invalid.nospam> - 2017-03-15 21:38 -0400

csiph-web