Replace Not with And Not in string [closed] - c#

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I have string
A Not B And Not C
I want this string to replace with
A And Not B And Not C.
means I want to replace all "Not" with "And Not" which are not followed by "And" keyword.

Maybe there's a more engineered solution, but this should do the trick:
var result = "A Not B And Not C".Replace("Not", "And Not").Replace("And And Not", "And Not")

Related

How to call a method for each value in a string? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have a string like this:
var mystring = ',32,33,34,35,36'
How can I call a method for each value?
There are many ways to do that.
For ex:
foreach (string i in mystring.split(','))
callYourFunction(i);
Does this suits you?

Validation Expression - C# [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I am trying to create a validation expression for a table name in the format of:
Name_TableName_YYYYMMDD
right now I have something like this:
^[a-zA-Z0-9][^_]+[a-zA-Z0-9][^_]+\d{8}
Number at the end can read 8 digits.
You could try this (very basic) expression
[a-zA-Z]+_[a-zA-Z]+_[0-9]{4}(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])
Link to a test

Allow Specific Characters in a textbox C# [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I need to allow specific characters in my textbox but not range of letters only those ( T, A, G, C ).. the problem is I can't find the regular expression pattern for that.
I think you can make it just with /[TAGC]/g.
I strongly recommend you to check out this site, you can test every regular expression you need there:
RegExr

Extract a substring after some string in C# [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
For example:
INPUT: sample="DA ---- Dear Allowance"
OUTPUT: "Dear Allowance"
I want this type of scenario in C#.
if all your strings have the same format like Code ---- FullName
you can do it simple-
string sName = "DA ---- Dear Allowance".Split(new string[]{"----"}, StringSplitOptions.RemoveEmptyEntries)[1].Trim();

Manipulation specific string c# [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have this string
%1111_Ç2222_Ç3333_
and I want remove the characters between the first and second _
Ç2222_
What is the best way to do this?
Thanks
maybe you want to go into this direction, but your question is not that clear...
string sIn = "%1111_Ç2222_Ç3333_";
string sOut = string.Join("_", sIn.Split('_').Where((x, index) => index != 1));

Categories