Goto main content

str_getcsv

Parse a CSV string into an array.

STR_GETCSV

NAME

str_getcsv - Parse a CSV string into an array.

SYNOPSIS

str_getcsv(input,delimiter,enclosure,escape)

PARAMETERS

input
The string to parse.
delimiter
Set the field delimiter. Defaults as a backslash (,).
enclosure
Set the field enclosure character. Defaults as a backslash (").
escape
Set the escape character. Defaults as a backslash (").

RETURN

Returns an indexed array containing the fields read.

EXAMPLES

in:  res=<{str_getcsv("Test,1.5,10,\"test\n\"\n  \"aa\"\" bb\"  ,11")}>.
out: res=[["Test","1.5","10","test\n"],["aa\\"\\" bb","11"]].

SEE ALSO

{{ include("includes/strings.sn") }}

AUTHOR

Written by Pusnei Sergey, <sergey@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2024 extenso Inc. All rights reserved.