Click here to Skip to main content
15,867,453 members
Articles / Programming Languages / C#
Alternative
Tip/Trick

Counting lines in a string

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
17 Jan 2012CPOL 6.8K   2
I had to do something like this in XSLT. If the string is not too long (for some definition of "too long"), you can replace all newlines with "" and then take the difference in the two string lengths.

I had to do something like this in XSLT. If the string is not too long (for some definition of "too long"), you can replace all newlines with "" and then take the difference in the two string lengths.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Program Manager InterSystems Corporation
United States United States
Greg has over 40 years of experience in software and hardware development. He has managed application, operating
systems, compiler, and database development groups; run multi-product documentation teams; directed customer service organizations; project-managed multi-million dollar projects; and directed product management and marketing operations groups. His experience includes liaison responsibilities with international organizations, particularly in Japan.

Comments and Discussions

 
GeneralI agree. However, in XSLT your iterative options are quite ... Pin
Greg Baryza17-Jan-12 9:42
Greg Baryza17-Jan-12 9:42 
GeneralIf you look at Index7 you will see that it does exactly that... Pin
OriginalGriff17-Jan-12 8:00
mveOriginalGriff17-Jan-12 8:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.