0

i have string in textbox:

  `New-Value = 12,34   -- Old-Values: 12,31,`

what i'd like to do is to get Old-Value so "12,31,"

How can i get from this textbox this specific information do this? So value is between ":" and ","

Tnx

0

3 Answers 3

2

Regex.Match("New-Value = 12,34 -- Old-Values: 12,31,",@"\:(.+)\,").Groups[1].Value.Trim()

Sign up to request clarification or add additional context in comments.

Comments

0
const string oldPointer = "Old-Values: ";
var text = "New-Value = 12,34   -- Old-Values: 12,31,";
var old = text.Substring(text.IndexOf(oldPointer) + oldPointer.Length).TrimEnd(',');

Comments

0

Not very clear if this is a fixed (static) format of your string, but by the way:

A simple solution could be:

string str = "New-Value = 12,34   -- Old-Values: 12,31,"; 
str.Substring(str.IndexOf(':') + 1);

More complex one should involve Regular expressions, like an answer of L.B or others if any.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.