Guidance
指路人
g.yi.org
Software / Reginald / Examples / odbcexam / SPLIT_INTO_STEM.REX

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
/*
 Breaks up a data string into a stem variable, using
 a specified delimiter.
 
 split_into_stem(delimiter, text, stem.)

 delimiter =	The pattern at which to break apart the data
 text =		The data string to break up. Must be a simple
	        or compound variable, not a stem.
 stem. =	The stem variable where the data is stored.
	        stem.0 will be set to the number of items, and
                stem.1 to stem.X are those items.

 Copyright Michael Simpson 2005
*/

USE ARG delimiter, text, stem.

DROP stem.

/* Assume one piece will be broken off */
i = 1

DO FOREVER

	/* Break off the next piece into "stem.i", and restore the remaining data in "text" */
	PARSE VAR text stem.i (delimiter) text

	/* Did we break anything off? */
	IF stem.i == "" THEN DO

		/* No, we didn't. So "text" is the last piece */
		IF text = "" THEN
			i = i - 1	/* If nothing left, then don't count this last, empty piece */
		ELSE
			stem.i = text	/* Store the last piece */

		/* All done. End the loop */
		SIGNAL done
	END

	/* Assume another piece will be broken off */
	i = i + 1
END

done:
/* Save the count */
stem.0 = i

RETURN
掌柜推荐
 
 
¥289.00 ·
 
 
¥1,080.00 ·
 
 
¥1,380.00 ·
 
 
¥638.00 ·
 
 
¥1,290.00 ·
 
 
¥1,420.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2010-07-16 20:49:09