Purpose
=================================================
	Join multiple lines to comma separated values for SQL use.
About
=================================================
	Author: wmjordan@163.com (W. Jordan)
	Version: 2010-9-11

Examples
=================================================
Example input (with no parameter specified):
123
456
789

Output:
123, 456, 789

Example input (with "/q:'" parameter specified):
abc
def
hijkl

Output:
'abc', 'def', 'hijkl'

Usage
=================================================
The output can be used in SQL commands, for example:
Select * from sometable where id in (123, 456, 789)
Select * from sometable where name in ('abc', 'def', 'hijkl')

Installation
=================================================
1, Copy ToCsvString.js to "(EditPlusDir)\filters\JoinLines\ToCsvString.js"
2, Setup the following Tool Settings in EditPlus:

The most two typical scenarios of this script are
1, encode values to CSV string (example 1)

	COMMAND=CScript.exe
	ARGUMENT="$(AppDir)\filters\JoinLines\ToCsvString.js" //NoLogo
	RUN_AS_TEXT_FILTER=Replace

2, encode values to quoted CSV string (example 2)

	COMMAND=CScript.exe
	ARGUMENT="$(AppDir)\filters\JoinLines\ToCsvString.js" //NoLogo /q:' /eq
	RUN_AS_TEXT_FILTER=Replace

You may want to setup two tools respectively.
If you are running EditPlus 3.2 build 449 or above, which allows icons for user defined tools, you may use "ToCsv.ico" for tool 1, and "ToQuotedCsv.ico" for tool 2.

References
=================================================
This script allows several parameters, which are:
/s:XYZ -- use XYZ as value separators
/q:ABC -- use ABC to quote values
/eq -- encode ' to '' (for SQL string values)
/t -- trim white spaces around values

You may want to change the separator, which by default is a comma followed by a space character, ", ". For example, input:
abc
def
hijkl

Output:
abc|def|hijkl

To do so, please specify the "s" parameter in the ARGUMENT of the tool settings, as the following shows, the default separator has been changed to "|".

	ARGUMENT="$(AppDir)\filters\JoinLines\ToCsvString.js" //NoLogo /s:|

If you want to use a space as the separator, you should use the following setting:

	ARGUMENT="$(AppDir)\filters\JoinLines\ToCsvString.js" //NoLogo /s:" "

If you want to use a Tab stop as the separator, use the following:

	ARGUMENT="$(AppDir)\filters\JoinLines\ToCsvString.js" //NoLogo /s:TAB
