Quantcast
Channel: String compare in C# - Stack Overflow
Browsing all 6 articles
Browse latest View live

Answer by vittore for String compare in C#

As Bauer said you can use String functions, also you can convert string to Char Array and work with it char by char

View Article



Answer by user287107 for String compare in C#

you should create a regex expression. to check if the 4th and 5th byte is 01, you can writevar r = new Regex("^.{4}01$");if(r.Match(str) ...) ...

View Article

Answer by Zach Johnson for String compare in C#

I think this may be what you want:if (input.Substring(4, 2) == "01"){ // do something}This will get a two character substring of input (starting at character 5) and compare it to "01".

View Article

Answer by gpmcadam for String compare in C#

MSDN has a great article on comparing strings, but you may want to refer to the String documentation for specific help, most notably: String.Compare, String.CompareTo, String.IndexOf, and...

View Article

Answer by Mark Byers for String compare in C#

Update: After seeing your comment I think you should parse the string as a DateTime:string s = "20090101";DateTime dateTime;if (DateTime.TryParseExact(s, "yyyyMMdd", null, DateTimeStyles.None, out...

View Article


String compare in C#

I have a string like 20090101 and I want to compare it with ????01??.if (input == "----01--") { .... }How can I compare the 5th and 6th characters with "01"?

View Article
Browsing all 6 articles
Browse latest View live




Latest Images