This function returns the number of comma delimited values in a text string. When there are no values in the string function the return value will be 1. One is returned because the function counts commas and adds 1 comma because the last value won't always be followed by a comma. This process is shown in the examples below.
Often used for looping over the fields, using the GetField function.
Syntax: |
---|
count = GetFieldCount( stringValue ) |
Parameter: |
Description: |
---|---|
stringValue |
Comma delimited string |
count |
Number of comma delimited values |
Example: |
---|
' No Commas and no values |
Results: |
sStringRecord : Return Count : 1 |
Example: |
' When a String variable can be empty, consider this modification |
Results: |
sStringRecord : Return Count : 0 |
Example: |
' No Comma After Last Value |
Results: |
sStringRecord : S,10,20,30,40 Return Count : 5 |
Example: |
' Comma After Last Value |
Results: |
sStringRecord : S,10,20,30,40, Return Count : 6 |
Links: |
---|
GetField, ReadLines, RemoveCommasBetweenQuote, RemoveNonDigits |
See Also: |
Edit Time: 9/18/2020 1:44:59 PM |
Topic ID#: 353 |