
	replace_string(3)	MudOS v21c2		(5 Sep 1994)

	名稱:
		replace_string() - 替換一個字串中符合條件的字.
	語法:
		string replace_string( str, pattern, replace );
		string replace_string( str, pattern, replace, max );
		string replace_string( str, pattern, replace, first, last );

		string str, pattern replace;
		int max, first, last;

		字串 replace_string( str, pattern, replace );
		字串 replace_string( str, pattern, replace, max );
		字串 replace_string( str, pattern, replace, first, last );

		字串 str, pattern replace;
		整數 max, first, last;
	用法:
		replace_string() 將 str 中所有符合條件的字 pattern 替換成
		指定的字 replace. 如果 pattern 沒有內容 (為零) , 就傳回原
		來的 str . 如果傳回的字串超過定義的最大字串長度, 則傳回一
		個 undefindp() 傳回 1, stringp() 傳回 0  的值.

		replace_string() 可以指定 replace  為空的字串, 以用來除去
		字串中特定的字. 舉例來說: replace_string(" 1 2 3 ", " ", "")
		會傳回 "123". replace_string() 執行的速度比用 explode() 和
		implode() 快.

		第四和第五個參數可有可無 (這是為了相容於以前的版本). 這兩個
		附加的參數有以下的功用:

		第四個參數 first:

		指定同一個字串最多替換幾次 (從 1  開始算). 如果這裡指定為 0,
		就當作是全部都換. 所以 replace_string("xyxx", "x", "z", 2) 
		會傳回 "zyzx".

		第五個參數 last:

		第五個參數限制符合條件的範圍:
		first < 1: 從頭開始全部替換.
		last == 0 或 last > 最高符合數(max_matches): 全部替換到最後. 
		first > last: 完全不改變.
		舉例: replace_string("xyxxy", "x", "z", 2, 3) 傳回 "xyzzy".
	參考:
		sscanf(3), explode(3), strsrch(3)
	作者:
		Zak@TMI-2 撰寫限制條件的部份.
	翻譯:
		Spock @ FF	97.Jun.2.		(printed 3/16/95)
