Click here to Skip to main content
15,891,184 members
Home / Discussions / C#
   

C#

 
GeneralRe: Need help using IndexOf() Pin
Ista30-Jul-03 10:55
Ista30-Jul-03 10:55 
GeneralRe: Need help using IndexOf() Pin
Rbledwards30-Jul-03 14:14
Rbledwards30-Jul-03 14:14 
GeneralRe: Need help using IndexOf() Pin
Julian Bucknall [MSFT]30-Jul-03 14:16
Julian Bucknall [MSFT]30-Jul-03 14:16 
GeneralRe: Need help using IndexOf() Pin
Ista30-Jul-03 14:38
Ista30-Jul-03 14:38 
GeneralRe: Need help using IndexOf() Pin
Julian Bucknall [MSFT]1-Aug-03 13:54
Julian Bucknall [MSFT]1-Aug-03 13:54 
GeneralRe: Need help using IndexOf() Pin
Ista1-Aug-03 16:44
Ista1-Aug-03 16:44 
GeneralCounting New Lines in a String Pin
draco_iii30-Jul-03 5:48
draco_iii30-Jul-03 5:48 
GeneralRe: Counting New Lines in a String Pin
Nathan Blomquist30-Jul-03 6:19
Nathan Blomquist30-Jul-03 6:19 
Check out the StringReader class. You could do something like:

public static int CountLinesInString(string str)
{
  System.IO.StringReader strR = new System.IO.StringReader(str);
  string temp = strR.ReadLine();
  int count = 0;
  while(temp != null)
  {
    count++;
    temp = strR.ReadLine();
  }  
  return count;
}


This would count the lines in the string. But this might not be exactly what you are looking for if you want an exact count of the character '\n'.

Hope this helps,
Nathan

---------------------------
Hmmm... what's a signature?
GeneralRe: Counting New Lines in a String Pin
draco_iii30-Jul-03 6:28
draco_iii30-Jul-03 6:28 
GeneralRe: Counting New Lines in a String Pin
Nathan Blomquist30-Jul-03 6:47
Nathan Blomquist30-Jul-03 6:47 
GeneralRe: Counting New Lines in a String Pin
leppie30-Jul-03 7:13
leppie30-Jul-03 7:13 
GeneralRe: Counting New Lines in a String Pin
Julian Bucknall [MSFT]30-Jul-03 14:19
Julian Bucknall [MSFT]30-Jul-03 14:19 
GeneralRe: Counting New Lines in a String Pin
Csharp™30-Jul-03 14:38
Csharp™30-Jul-03 14:38 
GeneralRe: Counting New Lines in a String Pin
GISnet1-Aug-03 2:50
GISnet1-Aug-03 2:50 
GeneralRe: Counting New Lines in a String Pin
Julian Bucknall [MSFT]1-Aug-03 13:57
Julian Bucknall [MSFT]1-Aug-03 13:57 
GeneralFishy += opperator Pin
eggie529-Jul-03 21:38
eggie529-Jul-03 21:38 
GeneralRe: Fishy += opperator Pin
Alexander Kojevnikov29-Jul-03 21:52
Alexander Kojevnikov29-Jul-03 21:52 
GeneralRe: Fishy += opperator Pin
eggie530-Jul-03 12:34
eggie530-Jul-03 12:34 
GeneralRe: Fishy += opperator Pin
Csharp™30-Jul-03 13:16
Csharp™30-Jul-03 13:16 
GeneralRe: Fishy += opperator Pin
Csharp™30-Jul-03 13:18
Csharp™30-Jul-03 13:18 
GeneralRe: Fishy += opperator Pin
Alexander Kojevnikov30-Jul-03 21:54
Alexander Kojevnikov30-Jul-03 21:54 
GeneralRe: Fishy += opperator Pin
Ista30-Jul-03 14:43
Ista30-Jul-03 14:43 
GeneralRe: Fishy += opperator Pin
Nick Parker30-Jul-03 17:32
protectorNick Parker30-Jul-03 17:32 
Generalremote installation from a webserver Pin
bhatti8129-Jul-03 20:37
bhatti8129-Jul-03 20:37 
GeneralRe: remote installation from a webserver Pin
Kannan Kalyanaraman30-Jul-03 5:31
Kannan Kalyanaraman30-Jul-03 5:31 

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.