Overview | Statement List | Example


替换字符串中的字符

Synopsis

REPSTR('target string','search string','replacement string',pos)

Description

Replaces a specific character string with another. In this function the target string is the string to be altered, the search string is the string to be found and the replacement string the new string. The pos value specifies a position in the string where the search is to begin. The search continues to the last position in the string or until the first occurrence of the search string is found. If the search string is not found, the target string is returned unchanged. If pos is less than one or greater than the number of characters in the string, the error message INVALID CHAR POS displays.

Parameters

Parameter

Description

'target string'

The literal string or string variable name of the string to be altered.

'search string'

The set of character(s) which gets searched for in the specified target string. Only the first occurrence of the search string, past the starting position (pos), is replaced.

'replacement string'

The set of character(s) which replaces the search string characters. The number of characters in the search and replacement strings do not have to be equal.

pos

Character position in the target string where the search begins. Pos must be an integer value greater than zero. Spaces (blank characters) are counted in determining a character's position in the target string. The positions are counted from left to right with the first character in the string being 1.

Figure 1-3 Numeric Positions of Characters in a String


Copyright ©2015 胡君NX二次开发官网(www.UGapi.com) QQ:85585969 All Rights Reserved.