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
Down2y 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
Down2y ago
okay thanks
Pobiega
Pobiega2y ago
Let me know if you get stuck
Down
Down2y 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
More Posts
❔ How to differentiate in C#?How can I differentiate a function like: "f(x)=sqrt(ax^2+b+cx)+gx+p+...etc" and every time it loops ✅ Problem With MYSQL Connection Using Entity FrameworkHello all, I am having problems to connect MYSQL. I think it can be related with my connection strin❔ About .NET Forms in Resources.resx files, what is the cost of removing PublicKeyToken?Second time in a couple months where my project breaks PublicKeyToken thanks to VisualStudio updatesautomated event handleri'm trying to index my bot's client with an event name but it throws an error, what's a way i can ac❔ is it possible to add // at beginning of text line when caret is in current line?Hello all, in a RichTextBox I split text by line, but I need to add the symbol **//** at the beginni✅ Schedule event at future DateTime based on DateOnly input, doesn't work if called <2min before```public static void ScheduleMethod(DateOnly inputDate) { DateTime triggerTime = new Da❔ Is something like this possible with the default DI package?So what I want to do is like this How scopes work normally: - global scope - scope 1 * duplicate methods from .GetMethods()```cs public ElfinCommand[] ReadCommands() { List<ElfinCommand> commands❔ Message box using small Segoe UI/skinny/classic theme for OK buttonI am making a simple C# program with MessageBox.Show. When I run it I get a message box with the tex❔ Client-Server ModelSo im hosting a server locally on 127.0.0.1 so currently i can only connect to it from my own comput