Friday, January 18, 2008

Sony The Ht-ddw7500 Mu.te.ki System Price

WinDev 12 - Splitter a string into an array

Here is a procedure that puts the values of a string separated by a separator defined in a table:

/ / Summary: To fill an array of string from a string and a separator

/ / Syntax:

/ / [ =] Split (string is, is string [, boolean is [, is int]])

/ /

/ / Parameters:

/ / sChaineCara (string): String to splitter

/ / sSeparateur (string): The separator to use

/ / bTrié (boolean - default = 0): False (default) the table is not sorted, true to have a sorted array

/ / PType (integer - default = 1): Type of sorts: ttCroissant or ttDécroissant

/ / Return Value:

/ / Table: / / array containing the values of the string passed as parameter.

/ /

/ / Example:

/ / tabSP is a dynamic array of 0 chains

/ /

/ / tabSP = Split ("foo; abc; zoro; aab; tata ",";", True, ttCroissant)

PROCEDURE Split (s ChaineCara is a string, s Separateur is a string, b Sorted is a Boolean = False , PType is an integer = ttCroissant )

tab Split is a dynamic array of 0 chains

s is a string / / loop variable

FOR ANY CHAIN s OF s ChaineCara SEPARATED BY s Separateur

TableauAjouteLigne ( tab Split , s)

END

IF b Sorted THEN

IF PType = 0 THEN PType = ttCroissant

TableauTrie ( tab Split , PType )

END

RETURN tab Split

Example usage

tab SP is a dynamic array of 0 chain

tab SP = Split ( "foo, abc, zoo; aab; tata , ";" , True , ttCroissant )

0 comments:

Post a Comment