Page 1 of 1

about Separate string by ","

Posted: Tue Feb 14, 2012 2:15 am
by Matt
how to get the count of a string Separate by “,” ? For example

"abc,off,kl,mell" Separate by "," and get the count , the result is 4!!!!

thanks

matt:kiss:

about Separate string by ","

Posted: Wed Feb 15, 2012 2:54 am
by HighAley
Hello, Matt.
Matt wrote:how to get the count of a string Separate by “,” ? For example
"abc,off,kl,mell" Separate by "," and get the count , the result is 4!!!!
Please add next code to the Code tab before auto generated code.

Code: Select all

public int SplitByCommaLength(string st)
{
    return  st.Split(new char[] {','}).Length;
}
Then you could use next expression in your report:

Code: Select all

{SplitByCommaLength("abc,off,kl,mell")}
Thank you.