Get word in betwen first and last of a 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 7 years ago.
Improve this question
my problem is to get word in between first and last of a string for example string st="abcdefghi" and my problem is to get only def

substring between first 3 and last 3 chars
string substring=str.Substring(3,str.Lenghth-6)

Related

How to remove curly braces from the xml using C# code [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 1 year ago.
Improve this question
Need to know how to remove curly braces from the xml code for C#
{<RESPONSE> <RESPONSE_TEXT>Registered P_UK4EZI</RESPONSE_TEXT> <RESULT>OK</RESULT> <RESULT_CODE>-1</RESULT_CODE> <TERMINATION_STATUS>SUCCESS</TERMINATION_STATUS> <MAC_KEY>KZzTDdNErHVNZzRRfKyrbuAj++J20IAF4XpmsmQFjdV7G4PauwHkUobkhEzjPRbD9GNUq5EtoOauxTSZHgsDeLx6FAWasSKb2FcsC7SMmCTV5VW4Wd5w+9tP1Hzy93wnedKPggExJbxA3BH8xvFjqvmiCHjB92fsPfHWXcqfMHhoRW8quA/B6jx44dm</MAC_KEY> <MAC_LABEL>P_UK4EZI</MAC_LABEL> <ENTRY_CODE>1570</ENTRY_CODE> </RESPONSE>}
string original = "{<RESPONSE> <RESPONSE_TEXT>Registered P_UK4EZI</RESPONSE_TEXT> <RESULT>OK</RESULT> <RESULT_CODE>-1</RESULT_CODE> <TERMINATION_STATUS>SUCCESS</TERMINATION_STATUS> <MAC_KEY>KZzTDdNErHVNZzRRfKyrbuAj++J20IAF4XpmsmQFjdV7G4PauwHkUobkhEzjPRbD9GNUq5EtoOauxTSZHgsDeLx6FAWasSKb2FcsC7SMmCTV5VW4Wd5w+9tP1Hzy93wnedKPggExJbxA3BH8xvFjqvmiCHjB92fsPfHWXcqfMHhoRW8quA/B6jx44dm</MAC_KEY> <MAC_LABEL>P_UK4EZI</MAC_LABEL> <ENTRY_CODE>1570</ENTRY_CODE> </RESPONSE>}";
original = original.Replace("{","").Replace("}","");
Fiddle: https://dotnetfiddle.net/vExrEE

how can i get string between two commas? [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 5 years ago.
Improve this question
I have a string like:
43965.96000,16933.986,404689.986,5814892.171,77.464,52.47585589,13.59670032,77.464,0.675,-0.223
I want to just keep the string which is bold in characters between commas. How can I do that?
To take your question literally, you could do write a method to split the string by comma and just take the element at the 5th index:
string ParseData(string data)
{
return data.Split(',')[5];
}
So you'll be able to do something like:
string data = "43965.96000,16933.986,404689.986,5814892.171,77.464,52.47585589,13.59670032,77.464,0.675,-0.223";
string result = ParseData(data); // Result = "52.47585589"

Regex pattern only unlimited numbers with max 2 digits after the comma [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 7 years ago.
Improve this question
Hei Guys
I got the regex for my software and it works. I only need the pattern that I will write between (" ") these. Thank you guys
The seperator should be a , or a .
Try this: '\d' for number, '\d+'for more numbers before ',' ...
\d+(,\d\d?)?
or
\d+(,\d{1,2})?

Create a 6 digit sequence number 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
How do i create a six digit sequence number in c# ?
Is there any other way than storing a string in the database like "000000" and later on incrementing it through the last inserted value ?
Use a plain old number as a sequence, this is what your DB will provide. If you want to display it with six digits, just call: yourNumber.ToString("D6")
(see docs)

Replace string "Prab\A\kar" to "Prab\kar" [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
I want to replace the string Prab\A\kar to Prab\kar
I have tried like this
string temp = #"prab\A\kar";
temp = temp.Replace(#"\A\", #"\");
and i got as "prab\\kar". As i mentioned in the title I want it as "Prab\kar"
temp = temp.Replace(#"\A\", #"\");

Categories

Resources