❔ string modify

DDown2/19/2023
how can i transform string like this 1234 5678 9123 4567 to this 1234 **** **** 4567 in a lambda function
DDown2/19/2023
public string CardNumber { get; set; }
public string CardNumberHidden => CardNumber ...
PPobiega2/19/2023
A few different ways. You could split on spaces, separate the first and the last element then replace the rest with *.
PPobiega2/19/2023
or you could count total amount of chars and use range indexes to extract the parts you want to show
DDown2/19/2023
okay thanks
PPobiega2/19/2023
Let me know if you get stuck
DDown2/19/2023
aight
Ccanton72/19/2023
Regex is another options, of course
AAccord2/20/2023
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.