ChrTran Function | |
Replaces each character in a character expression that matches a character in a second character expression with the corresponding character in a third character expression.
Namespace:
XSharp.VFP
Assembly:
XSharp.VFP (in XSharp.VFP.dll) Version: 2.21
Syntax FUNCTION ChrTran(
cSearchIn AS STRING,
cSearchFor AS STRING,
cReplaceWith AS STRING
) AS STRING
public static string ChrTran(
string cSearchIn,
string cSearchFor,
string cReplaceWith
)
Request Example
View SourceParameters
- cSearchIn
- Type: String
Specifies the expression in which ChrTran() replaces characters.
- cSearchFor
- Type: String
Specifies the expression containing the characters ChrTran() looks for in cSearchIn.
- cReplaceWith
- Type: String
Specifies the expression containing the replacement characters.
If a character in cSearchFor is found in cSearchIn, the character in cSearchIn is
replaced by a character from cReplaceWith that's in the same position in cReplaceWith
as the respective character in cSearchFor.
If cReplaceWith has fewer characters than cSearchFor, the additional
characters in cSearchIn are deleted from cSearchIn.
If cReplaceWith has more characters than cSearchFor, the additional characters in cReplacementExpression are ignored.
Return Value
Type:
String
Character
Remarks
The difference between ChrTranC() and ChrTran() can be ignored in X# because all characters are unicode,
so there is no distinction between single byte and double-byte characters.
Examples 1? ChrTran('ABCDEF', 'ACE', 'XYZ')
2? ChrTran('ABCD', 'ABC', 'YZ')
3? ChrTran('ABCDEF', 'ACE', 'XYZQRST')
See Also