./
pp_extractfields.pro
Routines
top source pp_extractfields
result = pp_extractfields(str [, count])
Given a string containing a comma-separated sequence of values, returns a string array with each value. Values can be quoted strings, in which case they can contain a comma inside them (which is why this routine exists, otherwise strsplit could do the job). Either type of quote can be used to mark the strings, but each string must be finished with the same type of quote it started.
Return value
A string array where each element is one of the comma-separated fields in str.
Parameters
- str in required
The string containing the comma-separated fields.
- count out optional
The number of fields found.
Examples
Split '"1,2","2","3","4"' into its fields:
print,pp_extractfields('"1,2","2","3","4"',count),count
;"1,2" "2" "3" "4"
; 4
Author information
- Author:
Paulo Penteado (pp.penteado@gmail.com)
Other attributes
- Uses:
Statistics
Lines: | 19 lines |
Cyclomatic complexity: | 6 |
Modified cyclomatic complexity: | 6 |
File attributes
Modification date: | Wed Jun 29 22:15:28 2016 |
Lines: | 19 |
Docformat: | rst rst |