INT %GetStrItemsCount( TEXT in string, TEXT in delimiter, TEXT in quoteChar := '"' ) |
| string | Text string. |
| delimiter | Delimiter. |
| quoteChar | The quote character (by default the " character). If the delimiter is inside the quotes, it is ignored. If quoteChar is specified as an empty string, the quotes are ignored. If entered as a multi-character string, the first character is counted. %GetStrItemsCount('A;B;"C;D";E' , ";") ; function returns 4 (the delimiter between quotes is ignored) |
%GetStrItemsCount("John;Michael;Charles;Jack;Martin",";") ; the function returns the value of 5
; the final values of function in specific cases
INT _i
TEXT _tStr,_tStrTest
_tStrTest := "asdf"
_i := %GetStrItemsCount(_tStrTest,";") ;_i = 1
_tStr := %GetStrItem(_tStrTest,1,";") ;_tStr = "asdf"
_tStrTest := "asdf;"
_i := %GetStrItemsCount(_tStrTest,";") ;_i = 2
_tStr := %GetStrItem(_tStrTest,1,";") ;_tStr = "asdf"
_tStr := %GetStrItem(_tStrTest,2,";") ;_tStr = ""
_tStrTest := ""
_i := %GetStrItemsCount(_tStrTest,";") ;_i = 1
_tStr := %GetStrItem(_tStrTest,1,";") ;_tStr = ""
_tStr := %GetStrItem(_tStrTest,2,";") ;_tStr = ""
_tStrTest := ";"
_i := %GetStrItemsCount(_tStrTest,";") ;_i = 2
_tStr := %GetStrItem(_tStrTest,1,";") ;_tStr = ""
_tStr := %GetStrItem(_tStrTest,2,";") ;_tStr = ""
|