Replace()
This function is used to replace a part of string, from within a Text string, with a new Text string
Syntax:
= Replace (Old Text, Start Number, Number of Characters, New Text)
Old Text = is the original text string
Start Number = is the position within the text from where the old text is to be replaced
Number of Characters = is the number of characters in the old string which are to be removed and replaced
New Text = is the new text string that will be placed at the position referred by Start Number
Example:
- = Replace ("Mohit Khurana", 1, 1, "R") - result will be - Rohit Khurana
- = Replace ("Rajeev", 5, 2, "sh") - result will be - Rajesh
- = Replace ("Alpha", 1, 5, "Beta") - result will be - Beta
- = Replace ("Alpha Beta Gamma", 10, 1, "ter") - result will be - Alpha Better Gamma
Note: note the highglighted characters in the above examples. The number of characters to be removed and the number of new characters to be inserted may not be same. You can insert as many characters as you want in place of any number of characters from the string
0 comments:
Post a Comment