C
C#2y ago
Down

❔ string modify

how can i transform string like this 1234 5678 9123 4567 to this 1234 **** **** 4567 in a lambda function
7 Replies
Down
DownOP2y ago
public string CardNumber { get; set; }
public string CardNumberHidden => CardNumber ...
public string CardNumber { get; set; }
public string CardNumberHidden => CardNumber ...
Pobiega
Pobiega2y ago
A few different ways. You could split on spaces, separate the first and the last element then replace the rest with *. or you could count total amount of chars and use range indexes to extract the parts you want to show
Down
DownOP2y ago
okay thanks
Pobiega
Pobiega2y ago
Let me know if you get stuck
Down
DownOP2y ago
aight
canton7
canton72y ago
Regex is another options, of course
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server