Porovnávané verzie

Kľúč

  • Tento riadok sa pridal
  • Riadok je odstránený.
  • Formátovanie sa zmenilo.

%GetStrItem function


Function
The function returns the word on the specified position in a text string, while the words are divided by the specified delimiter.


Declaration


Blok kódu
languageesl
themeConfluence
TEXT %GetStrItem(
   TEXT in string, 
   INT 	in seq_number,
   TEXT in delimiter,
   BOOL	in bTrim := @TRUE,
   TEXT in quoteChar := '"'
 )


Parameters


stringText string.
seq_numberThe sequence number of the word.
delimiterDelimiter.
bTrim

@TRUE - The returned word will be trimmed.

@FALSE - The returned word will not be trimmed.

quoteChar

The quote character (by default the " character). If the delimiter is inside the quotes, it is ignored. Also, if the resulting word is in quotes, they will be trimmed.
If quoteChar is specified as an empty string, the quotes are ignored. If entered as a multi-character string, the first character is taken into account.
Examples:

%GetStrItem('A;B;"C;D";E',3,";", @FALSE)                 ; function returns C;D (quotes at start/end are trimmed, delimiter between quotes is ignored)
%GetStrItem('A;B;"C;D";E',3,";", @FALSE, "")            ; the function returns the value "C     (it also returns a quote, the delimiter is taken into account)
%GetStrItem('A;B;"C;D";E',4,";", @FALSE, "")            ; the function returns the value D"    (it also returns a quote, the delimiter is taken into account)


Example


Blok kódu
languageesl
themeRDark
%GetStrItem("John;Michael;Charles;Jack;Martin",3,";") 				 ; the function returns the value of "Charles"
%GetStrItem("John;Michael;  Charles ;Jack;Martin",3,";") 			; the function returns the value of "Charles"
%GetStrItem("John;Michael;  Charles ;Jack;Martin",3,";", @FALSE) 	; the function returns the value of "  Charles "