You could do this:
int count = test.Split('&').Length - 1;
Or with LINQ:
test.Count(x => x == '&');
More Related Contents:
- Get all checked nodes of a treeview
- C#. split identificator on the words [closed]
- Distinct by property of class with LINQ [duplicate]
- How can I strip HTML tags from a string in ASP.NET?
- Regular Expression Groups in C#
- Regular Expression to split on spaces unless in quotes
- C# – code to order by a property using the property name as a string [duplicate]
- How to get values from IGrouping
- LEFT JOIN in LINQ to entities?
- Can I specify my explicit type comparator inline?
- Find the most occurring number in a List
- Entity Framework (.NET Full Framework) Ordering Includes [duplicate]
- How to compare only date components from DateTime in EF?
- Find character with most occurrences in string?
- Why use AsQueryable() instead of List()?
- Translate Perl regular expressions to .NET
- Are Java and C# regular expressions compatible?
- C# – Regex for file paths e.g. C:\test\test.exe
- convert this LINQ expression into Lambda
- how do I chunk an enumerable?
- Code equivalent to the ‘let’ keyword in chained LINQ extension method calls
- Select all columns after JOIN in LINQ
- Creating a LINQ select from multiple tables
- Parsing formatted string
- how do access previous item in list using linQ?
- How do I compose Linq Expressions? ie Func
- Is it possible to perform joins across different databases using LINQ?
- is there a elegant way to parse a word and add spaces before capital letters
- If Else in LINQ
- Parsing a string C# LINQ expression