Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > microsoft.public.scripting.vbscript > #11141
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | "Dave \"Crash\" Dummy" <invalid@invalid.invalid> |
| Newsgroups | microsoft.public.scripting.vbscript |
| Subject | Re: VbScript and .NET objects |
| Date | Sun, 30 Aug 2015 21:45:07 -0400 |
| Organization | A noiseless patient Spider |
| Lines | 54 |
| Message-ID | <ms0bfn$l4$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> <mrvc7v$d91$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Mon, 31 Aug 2015 01:43:20 +0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="847cb9ac544c0d3986237452b863d7e6"; logging-data="676"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+VKed1y1V0/VU0iJ/89OPeXcFdXQYAuR0=" |
| User-Agent | Thunderbird 2.0.0.24 (Windows/20100228) |
| In-Reply-To | <mrvc7v$d91$1@dont-email.me> |
| Cancel-Lock | sha1:iyP43lzVDM5KkJOAEJewhTXN1/M= |
| Xref | csiph.com microsoft.public.scripting.vbscript:11141 |
Show key headers only | View raw
Mayayana wrote: > | > 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. I use the Mid function to emulate the lacking Mid statement: s1=mid(s1,1,100) & "sample" & mid(s1,101) As always in VBS, there are several ways to perform a task. Not recommended, but works: s1=replace(s1,left(s1,100),left(s1,100) & "sample",1,1) -- Crash Registered pedophobe
Back to microsoft.public.scripting.vbscript | Previous | Next — Previous in thread | Next in thread | Find similar
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