Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: one more string manipulation question


Message #1 by "Daniel O'Dorisio" <dodorisio@h...> on Fri, 22 Jun 2001 13:37:02
i we3nt ahead with the array approach, (allmost went with this style) but i
needed to do stuff with the other values as well (i know i didnt mention
that, but i found out later that i needed to), and the array made it pretty
easy. pl;us this is just a word macro and i didnt see too much performance
drop. thanks though.

daniel

Daniel O'Dorisio
dodorisio@h...
xxx-xxx-xxxx


-----Original Message-----
From: Pickersgill, Simon [mailto:simon.pickersgill@d...]
Sent: Monday, June 25, 2001 3:58 AM
To: professional vb
Subject: [pro_vb] RE: one more string manipulation question


Daniel,

If you want to cut down on the number of lines of code, and the overhead of
having to declare a dynamic array (not exactly optimised) you could do
exactly what you want in one line.  Remember that the array approach will
become more and more uneconomical the longer your string is.

Dim theString 'I assume this is already declared somewhere in your code
theString = "bloggs, joe, 757-555-1212, 5"
theString = Trim(Mid(theString, InstrRev(theString, ",") + 1))  'And "hey
presto!" everything after the last comma trimmed and ready to go...

Both of these approaches will fall down if you want to return a phrase after
the last comma.  Say, for example, your string is:
bloggs, joe, 757-555-1212, 5, "123, Main Street, New York"...  In this case
I would recommend that you investigate Regular Expressions.

Regards,

Simon Pickersgill
Project Manager
domainnames.com (a Verisign Company)
http://www.domainnames.com
Tel: +44 (0)191 525 2420
Fax: +44 (0)191 525 2430



  Return to Index