Click here to Skip to main content
12,699,898 members (35,061 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as



Counting lines in a string

, 9 Jan 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
Can't we have something as below?int n=(s.Split(new char[]{'\n'})).Length;where n is the number of lines?

Can't we have something as below?

int n=(s.Split(new char[]{'\n'})).Length;

where n is the number of lines?


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


About the Author

CEO Integrated Ideas
India India
gasshopper.iics is a group of like minded programmers and learners in codeproject. The basic objective is to keep in touch and be notified while a member contributes an article, to check out with technology and share what we know. We are the "students" of codeproject.

This group is managed by Rupam Das, an active author here. Other Notable members include Ranjan who extends his helping hands to invaluable number of authors in their articles and writes some great articles himself.

Rupam Das is mentor of Grasshopper Network,founder and CEO of Integrated Ideas Consultancy Services, a research consultancy firm in India. He has been part of projects in several technologies including Matlab, C#, Android, OpenCV, Drupal, Omnet++, legacy C, vb, gcc, NS-2, Arduino, Raspberry-PI. Off late he has made peace with the fact that he loves C# more than anything else but is still struck in legacy style of coding.
Rupam loves algorithm and prefers Image processing, Artificial Intelligence and Bio-medical Engineering over other technologies.

He is frustrated with his poor writing and "grammer" skills but happy that coding polishes these frustrations.
Group type: Organisation

117 members

You may also be interested in...

Comments and Discussions

GeneralReason for my vote of 5 nice comparison, well illustrated. Pin
Ravi Gupta from India17-Jan-12 9:21
memberRavi Gupta from India17-Jan-12 9:21 
GeneralReason for my vote of 5 I give your alternative 5 stars beca... Pin
Robby Tendean10-Jan-12 0:11
memberRobby Tendean10-Jan-12 0:11 
GeneralI have added your method to teh tip - I am not surprised tha... Pin
OriginalGriff9-Jan-12 2:19
mvpOriginalGriff9-Jan-12 2:19 

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.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170118.1 | Last Updated 9 Jan 2012
Article Copyright 2012 by Grasshopper.iics
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid