Kenneth Ismert
kismert at gmail.com
Wed Aug 8 10:17:03 CDT 2012
> > Heenan, Lambert: > Const ARGDELIM as String = "♣♣♣" > Then just use the Const in constructing the delimited string. > > Stuart McLachlan: > Ahem! Ever hear of an ASCIIZ / C String ? > ... > Guess I'll have to stop doing things like this! > strTest = "A quote ( " & chr$(34) & ") character by itseld" > > Gustav Brock: > It even has a name in VB(A): vbNullChar > Keep the context in mind: You are taking a string from the wild, which by definition can contain any of the strings you mention, and you are quoting it with some delimiter, so you can break it apart with Split(). This is exactly analogous to the string literal assignment in VBA: var = "some literal string" Now, what happens when you need the delimiter character (") in the string? In all language parsers I can recall, you must quote the delimiter. In VBA, the rule is: var = "some ""quoted literal""" This cannot fail, but you also cannot use Split. You have to roll your own parser, which isn't rocket science. I ask you, if they were roughly the same effort, would you prefer: 1. A solution that usually works, with a known defect 2. A solution that almost always works, with a known, but 'better' defect 3. A solution that by definition cannot fail Maybe its my excessive pride or stubbornness, but I choose 3 if it is practical and reasonable. If I do have to settle on 1 or 2, I at least DOCUMENT THE BUG. -Ken