views:

553

answers:

6

I've written a little program to download images to different folders from the web. I want to create a quick and dirty batch file syntax and was wondering what the best delimiter would be for the different variables.

The variables might include urls, folder paths, filenames and some custom messages.

So are there any characters that cannot be used for the first three? That would be the obvious choice to use as a delimiter. How about the good old comma?

Thanks!

A: 

Choose a delimiter that has the least chance of collision with the names of any variable that you may have (which precludes #, /, : etc). The comma (,) looks good to me (unless your custom message has a few) or < and > (subject to previous condition).

However, you may also need to 'escape' delimiter characters occurring as part of the variables you want to delimit.

dirkgently
+1  A: 

Why not just use something that exists already? There are one or two choices, perl, python, ruby, bash, sh, csh, Groovy, ECMAscript, heavens for forbid windows scripting files.

I can't see what you'd gain by writing yet another batch file syntax.

wentbackward
+1  A: 

Tabs. And then expand or compress any tabs found in the text.

le dorfier
A: 

This sounds like a really bad idea. There is no need to create yet another (data-representation) language, there are plenty ones which might fit your needs. In addition to Ruby, Perl, etc., you may want to consider YAML.

Designing good syntax for these sort of this is difficult and fraught with peril. Does reinventing the wheel ring a bell?

JesperE
A: 

You can use either:

  1. A Control character: Control characters don't appear in files. Tab (\t) is probably the best choice here.
  2. Some combination of characters which is unlikely to occur in your files. For e.g. #s# etc.

Tab is the generally preferred choice though.

Nikhil
A: 

I would use '|'

It's one of the rarest characters.

Cyril Gupta