Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 9 months ago.
Improve this question
I need to send a plus(+) operator as string from typescript service to C# Controller. When I debug it, typescript sends as "+", but in C# Controller, the parameter comes as null. The equal sign or negative sign(=,-) are working fine. Just plus sign has a problem. For example if I try to send "13+" plus is recognized as a blank -> "13 " in controller How can I solve it?
+ means space in an URL, so I'm assuming you're assembling an url query string by hand? If so, you need to encode + to %2B.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I have a database field called "PIECE" which datatype is NUMERIC(11,0),
I must convert this field to a long-datatype.
This without any luck or succes, I'll keep getting the same error:
Wrong conversion...
I tried the next things:
(long)PIECE
long.Parse(PIECE.ToString().Trim())
But I'm still having the wrong conversion message,
is here someone who can help me?
This will do it:
var result = Convert.ToInt64(PIECE);
https://msdn.microsoft.com/en-us/library/0zahhahw(v=vs.110).aspx
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
Found this csv parser: https://github.com/bytefish/TinyCsvParser
Following his example but I even added one int property.
By setting a negative value to that int, it gave me one unvalid row.
Couldn't find any solution for this simple? problem.
The type converter was using the wrong NumberStyle as default. I have fixed the problem and added a Test case to the project: https://github.com/bytefish/TinyCsvParser/issues/2.
You could also instantiate a custom converter with the right NumberStyle (see WithCustomConverter, Example), but I suggest simply updating to the latest version (0.6), which is also updated in NuGet.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I have a file contains a lot of C functions' declarations.
For example,
void Add (int a, int b);
void AddWithCarry (int a, int b);
And I am requesting the user to enter the name of the function he wants to delete and then the whole line should be deleted.
I have done the following psuedo code:
Check if line.Contains(string)
If yes, delete the whole line.
If not, check the other line.
It worked fine if the user requests to delete AddWithCarry function, but if the user requests to delete the Add function, both lines will be deleted as both of them contains the Add string.
How could I overcome this problem ?
Replace your if with:
if(line.Replace(" ", string.Empty).Contains(string + "("))
Not the prettiest way, but should work, as long as function calls are in format of : funcName();
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
Below are the test input . The result I want is AAA- and AB-- respectively. The input string has no specific pattern. So first occurrence of / and the 4 character before that is the result I want to have.
Test line abc (r);AAA-/2010/001
Test line abc (r);AB--/2010/001
Like that? (EDIT: in .NET regex patterns, / does not need escaping)
(.{4})/
Consider sites like https://regex101.com for future needs)
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I am new to RegEx and looking for a solution to this condition. I am writing my code in C# and don't want to use any STRING functions.
Below is a sample string that I get:
610WBDFGFGM0122544
Now the condition I need to check is,
If string starts with "6" && 6th character is "D"
Can anyone tell me how to write RegEx for the above condition?
You can use this regex:
^6.{4}D
Here, ^ is the start of the string, .{4} means any four characters.
Online demo