21
Views
4
Solved
###### How to hide  middle number of phone  and need to show 3 first and last digit
Question
Application Type
Mobile

HI All,

How i we can hide some digit of phone number and need to display start and end 3 number of phone

For Exm-  +912*****456

Need to achive on mobile can anyone please suggest the way,

Solution

Hi Soni,

Try this if it fits for all your use cases.

Please validate the number length & format before applying this expression.

Give input string in below example number.

`Replace("InputNumber",Substr("InputNumber",4,6),"******")`
`Replace("+911234567456",Substr("+911234567456",4,6),"******")`

Thanks,

Vani

Use the string Substr and index function, to get the first numbers and the last numbers, as you can do the logic of the split you know how many will be hiding, so it's possible to do this way. You can use the function from OutSystems, or you can use this forge component https://www.outsystems.com/forge/component-overview/9331/split-string that takes what you want, you can use space as a separator! :)

Remember there will be 3 expressions. 1 for the first numbers, the second the count of numbers that will be hiding with *, and then the 3 will have the last numbers! :)

Regards,

Márcio C.

Solution

Hi Soni,

Try this if it fits for all your use cases.

Please validate the number length & format before applying this expression.

Give input string in below example number.

`Replace("InputNumber",Substr("InputNumber",4,6),"******")`
`Replace("+911234567456",Substr("+911234567456",4,6),"******")`

Thanks,

Vani

Basically, I created a function to do that conversion. Be aware I am not doing any validation

You can also check the implementation in oml attached.

Regards

Gonçalo Almeida

PhoneNumber.oml

Thanks u everyone for help

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.