locked
Mapping Issue RRS feed

  • Question

  • I have a field where i am getting masked number as 9813ABDG1243. I need to convert this into 981300001243.

    ie. I need to replace all the alphabets with number 0. How to achieve this?

    Thursday, June 9, 2016 7:08 AM

Answers

  • You have to use Inline C# in scripting functoid and use Regex.Replace.

    Just replace all undesired characters with an zero in string sequence:

    public string ReplaceAlphabet(string number)
            {
               
                string filtered = Regex.Replace(number, "[A-Za-z]", "0");
                return filtered;
            }
    



    Rachit Sikroria (Microsoft Azure MVP)



    Thursday, June 9, 2016 7:10 AM
    Moderator

All replies

  • You have to use Inline C# in scripting functoid and use Regex.Replace.

    Just replace all undesired characters with an zero in string sequence:

    public string ReplaceAlphabet(string number)
            {
               
                string filtered = Regex.Replace(number, "[A-Za-z]", "0");
                return filtered;
            }
    



    Rachit Sikroria (Microsoft Azure MVP)



    Thursday, June 9, 2016 7:10 AM
    Moderator
  • Hi Satish

    Use this in a custom C# inline scripting functoid. Connect source element as input to the functoid, connect the functoid output to the destination element-

    public string replaceAlphabets(string param1)
    {
    return System.Text.RegularExpressions.Regex.Replace(param1, "[A-Za-z ]", "0");
    }



    Thanks Arindam




    Thursday, June 9, 2016 7:11 AM
    Moderator
  • Thanks rachit.. It worked :) Thanks for your continous support.
    Thursday, June 9, 2016 7:35 AM