How to use translate operation in String Function Using XPath in Xml

In this article I will explain translate operation of string function.
  • 2064

Introduction

Translate function is used to returns the first argument string with occurrences of characters in the second argument string replaced by the character at the corresponding position in the third argument string. The second and third argument describes or explain the scheme of mapping that how the first argument map the second and third, and the first argument provides mapping of characters.This function is case-sensitive.

Syntax

string translate (string, string, string)

Hear translate is the string function which is used to translate the first argument string according to the second and third argument string.

Example

translate("richa","abcd","ABCD")
translate("rrrrrr--","pqrs--","PQRS")

In the second example the following concept is applied :
If the character in the second argument string does not match with the third argument string,that means the second argument string is longer than the third argument string,than the occurance of that character in the first argument will be removed.

Output

riChA
RRRRRR

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.