Raja.G
(Mr.RPABot)
May 31, 2023, 9:49am
1
Hi Team,
I have input 16digit number (1234567891011121) i want to validate only first 6 digit and last 4 digit from input number to output number
output number is 123456******7891
If match first 6 digit and last 4 digit true else false
Regards,
Raja G
Hi @Raja.G
You can compare both input & output strings using the following expressions:
First 6 digits: strValue.Substring(0,6)
Last 4 digits: strValue.Substring(strValue.Length-5,4)
Hope this helps,
Best Regards.
1 Like
Raja.G
(Mr.RPABot)
May 31, 2023, 10:06am
3
Hi @arjunshenoy ,
This is condition only i want to match input 16 digit to output 16digit but output 16 digit show like 256489******2222
So i want to match fist 6 digit and last 4 digit
Regards,
Raja G
Hi @Raja.G ,
Try this:
"1234567891017891".Remove(6,6).Equals("123456******7891".Remove(6,6))
Regards,
@Raja.G
The first expression will be valid for the first 6 values extraction. You can use the following expression to obtain last 4 values:
System.Text.RegularExpressions.Regex.Match(strValue,"\d{4}$").ToString
Hope this helps,
Best Regards.
Hello @Raja.G
Try something like below
strCardValue1 = "1234567891011121"
strCardValue2 = "123456******7891"
If Left(strCardValue1,6) = Left(strCardValue2,6) AndAlso Right(strCardValue1,4) = Right(strCardValue2,4) then
b_IsCardMatching = True
else
b_IsCardMatching = False
end if
1 Like
@Raja.G
Assign firstString = “2564892222"
Assign secondString = "216489 2223”
Matches firstStringMatches = System.Text.RegularExpressions.Regex.Matches(firstString, “^\d{6}.\d{4}$")
Matches secondStringMatches = System.Text.RegularExpressions.Regex.Matches(secondString, "^\d{6}. \d{4}$”)
If firstStringMatches.Count > 0 AndAlso secondStringMatches.Count > 0
Assign firstMatch = firstStringMatches(0).Value
Assign secondMatch = secondStringMatches(0).Value
If firstMatch = secondMatch
// First 6 digits and last 4 digits match
// Add your desired actions here
Else
// First 6 digits and last 4 digits do not match
// Add your desired actions here
End If
End If
Parvathy
(PS Parvathy)
May 31, 2023, 10:45am
8
Hi @Raja.G
Follow the below syntax to achieve the required output. Have attached the workflow for reference.
Sequence:
Assign:
inputNumber= “1234567891011121”
Assign:
outputNumber= inputNumber.Substring(0, 6) + " **" + inputNumber.Substring(12, 4)
If:
inputNumber.Substring(0, 6) = outputNumber.Substring(0, 6) And inputNumber.Substring(12, 4) = outputNumber.Substring(12, 4)
Then:
Log Message: “Validation successful”
Else:
Log Message: “Validation failed”
Credit Card Number.xaml (7.6 KB)
Hope it helps!!
Regards,
system
(system)
Closed
June 3, 2023, 10:45am
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.