We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Credit Card string


How can I mask a credit card number input in a dataform. 

2 Replies

SP Subburaj Pandian Veluchamy Syncfusion Team August 2, 2019 12:49 PM UTC

Hi Mario,                     
Thank you for contacting Syncfusion support. 
Based on provided information, your requirement of “Mask the Credit card number using DataForm” can be achieved by using MaskedEditText editor in DataForm. 
Please find the code snippet for the same, 
dataForm.AutoGeneratingDataFormItem += DataForm_AutoGeneratingDataFormItem; 
        private void DataForm_AutoGeneratingDataFormItem(object sender, AutoGeneratingDataFormItemEventArgs e) 
            if (e.DataFormItem.Name.Equals("CardNumber")) 
                var maskedItem = e.DataFormItem asDataFormMaskedEditTextItem; 
                maskedItem.Mask = "0000-0000-0000-0000"; 
                maskedItem.PromptChar = 'X'; 
                maskedItem.KeyBoard = Keyboard.Numeric; 
We have prepared the simple sample for the same. Kindly, check the sample from following link. 
Please refer our User Guide documentation for more details, 
We hope that this helps you. Kindly, revert us if you have any concern. 
Subburaj Pandian V  

AD Amit Das July 8, 2021 05:27 AM UTC

You can visit to this website for more information Stackoverflow

from pyspark.sql.types import * tst= sqlContext.createDataFrame([("name1",9999999999),("name2",2222222222)],schema=['name','number']) # This is assuming your card number is not a string. If not skip this cast tst_cast = tst.withColumn("number_string",F.col('number').cast(StringType())) tst_mask = tst_cast.withColumn("masked_number",F.concat(F.lit('******'),F.substring(F.col("number_string"),6,4)))

Live Chat Icon For mobile
Up arrow icon