ElaKiri Programmer's Club

san1020

Well-known member
  • Jun 8, 2011
    3,496
    506
    113
    ලැප ඉදිරියේ
    Code:
    static int [U]CountChars[/U](string value) {     int result = 0;     bool lastWasSpace = false;      foreach (char c in value)     { 	if (char.IsWhiteSpace(c)) 	{ 	    [I]// A. 	    // Only count sequential spaces one time.[/I] 	    if (lastWasSpace == false) 	    { 		result++; 	    } 	    lastWasSpace = true; 	} 	else 	{ 	    [I]// B. 	    // Count other characters every time.[/I] 	    result++; 	    lastWasSpace = false; 	}     }     return result; }
     

    DJvodka

    Well-known member
  • Mar 31, 2009
    3,375
    292
    83
    A land like no other
    machan mekai mata string count ekak hadanna one. mata one file textbox ekakata load karan eke character count eka ganna one. string eke length aran eken thiyena spaces adu karala. 1d array eken kara ethakota load karana file eke multi lines gihin thibboth case. single line nam shape count eka enawa.
    enisa 2d array ekak onane multi lines giya text ekaka count eka ganna.

    mata methana thiyena lokuma prashne text eka kohomada 2D array ekakata convert karaganne naththam 2D array ekaka store karanne kiyala ps help me.


    mage danata code eka meka(meke mata asd kiyana array ekata file eke thiyena text eka store karaganna bane)

    private void button1_Click(object sender, EventArgs e)
    {
    string file = "D://test1.txt";
    System.IO.StreamReader obj = new System.IO.StreamReader(file);

    char[,] asd = new char[textBox1.Text.Length, textBox1.Text.Length];
    int count = textBox1.Text.Length;
    textBox1.Text = obj.ReadToEnd();
    int rea = 0;
    int spaces = 0;
    for (int i = 0; i <asd.Length; i++)
    {
    for (int j = 0; j < asd.Length; j++)
    {
    if (asd[i,j].Equals(" "))
    {

    spaces = spaces + 1;
    }

    }
    }
    rea = count - spaces;
    MessageBox.Show(rea.ToString());

    }
    }

    prashne pehedili madi. Textbox eke thiyena string eke spaces nathuwa ena characters wala (Alphanumeric) count ekada ona?
     

    mithunmaxxx

    Junior member
  • Oct 20, 2007
    116
    8
    18
    machn loop krnnae natuwa mae widihta goda danna puluwan try....

    System.IO.StreamReader obj = new System.IO.StreamReader(file);
    textBox1.Text = obj.ReadToEnd();
    string newstring = textBox1.Text.Replace("\r\n", string.Empty);
    int count = newstring.Trim().Count();
    int emtycount = newstring.Count(a => a == ' ');
    int totallcharcount = count - emtycount;
     
    Last edited:

    rhn123

    Well-known member
  • Jul 20, 2012
    759
    37
    48
    file eke text eka string ekakata aran meka dala balanna . web eken gaththe ;)
    Code:
    int result = 0;     bool lastWasSpace = false;      foreach (char c in value)     { 	if (char.IsWhiteSpace(c)) 	{ 	    [I]// A. 	    // Only count sequential spaces one time.[/I] 	    if (lastWasSpace == false) 	    { 		result++; 	    } 	    lastWasSpace = true; 	} 	else 	{ 	    [I]// B. 	    // Count other characters every time.[/I] 	    result++; 	    lastWasSpace = false; 	}     }     return result;

    thanks machan ;)
     

    rhn123

    Well-known member
  • Jul 20, 2012
    759
    37
    48
    machn loop krnnae natuwa mae widihta goda danna puluwan try....

    System.IO.StreamReader obj = new System.IO.StreamReader(file);
    textBox1.Text = obj.ReadToEnd();
    string newstring = textBox1.Text.Replace("\r\n", string.Empty);
    int count = newstring.Trim().Count();
    int emtycount = newstring.Count(a => a == ' ');
    int totallcharcount = count - emtycount;

    hm try karala balannam. eth man karana widiya poddak mata try karala balanna one bn . ela thanks :D
     

    keshara

    Well-known member
  • Sep 20, 2006
    2,039
    418
    83
    symfony framework eka danna kenek innawanam mata pm ekak danawada podi help ekak illa ganna
     

    DJvodka

    Well-known member
  • Mar 31, 2009
    3,375
    292
    83
    A land like no other
    character count eka thamai machan

    Code:
    private void button1_Click(object sender, EventArgs e)
    {
    string file = "D://test1.txt";
    System.IO.StreamReader obj = new System.IO.StreamReader(file);
    
    textBox1.Text = obj.ReadToEnd();
    
    string txt = textBox1.Text;
    
    txt = txt.Replace(" ", "");
    
    int rea = txt.Length;
    
      
    MessageBox.Show(rea.ToString());
    
    }
     

    Fox Mulder89

    Well-known member
  • Dec 31, 2012
    2,460
    942
    113
    gampaha
    I am asking this question in this tread is becouse lots of programmers talking here.

    I am a BIT(External) student in semester 5.currently i am developing my system using php.

    my question is after got BIT and if i choose PHP developer how much salary could i get after 1 year experiance.

    thanks you.:yes::yes:








     

    M E T H

    Active member
  • Oct 23, 2013
    647
    48
    28
    I am asking this question in this tread is becouse lots of programmers talking here.

    I am a BIT(External) student in semester 5.currently i am developing my system using php.

    my question is after got BIT and if i choose PHP developer how much salary could i get after 1 year experiance.

    thanks you.:yes::yes:









    25-40 :sorry: if u are best in PHP , its better to do freelancing :yes:
     

    Tom Riddle

    Member
    Aug 31, 2007
    1,833
    196
    0
    C# machan. man eka line ekak yana ekak try kara machan. eka wada. multiple lines yaddi wada na :'( dawas ganak mekama adinawa. mata therenne na bn magula

    ah eka thama mama me baluwe purudu nathi constructs tikak thiyenawa mokada kiyala.

    mama hituwe mata java amathaka wela kiyala. lol. :rofl:

    anyways oka karanna 2d array ekak ona wenna kisima hethuwak ne mona language eken karath.

    passe anith kattiya deepu uththara walin wede goda daganna athi ne kohomath.
     

    Tom Riddle

    Member
    Aug 31, 2007
    1,833
    196
    0
    I am asking this question in this tread is becouse lots of programmers talking here.

    I am a BIT(External) student in semester 5.currently i am developing my system using php.

    my question is after got BIT and if i choose PHP developer how much salary could i get after 1 year experiance.

    thanks you.:yes::yes:

    only choose to do PHP if you are not comfortable with other types of programming / you are seriously good at web development. (and I do not just mean PHP, but the whole HTML, CSS, Javascript thing with some knowledge of CMSs, a smattering of Javascript and PHP frameworks and knowledge of new web tech such as Node.js .

    You can earn a lot by doing freelancing if you are any good. Choosing it as a career path is :confused::confused: ane manda. Not good for you financially.
     
    • Like
    Reactions: Fox Mulder89

    rhn123

    Well-known member
  • Jul 20, 2012
    759
    37
    48
    Code:
    private void button1_Click(object sender, EventArgs e)
    {
    string file = "D://test1.txt";
    System.IO.StreamReader obj = new System.IO.StreamReader(file);
    
    textBox1.Text = obj.ReadToEnd();
    
    string txt = textBox1.Text;
    
    txt = txt.Replace(" ", "");
    
    int rea = txt.Length;
    
      
    MessageBox.Show(rea.ToString());
    
    }

    wada na bn :sorry: text file eke eka line ekak thibbama count eka hari . linees 2k wage pahalata yaddi count eka waradi.
     
    Last edited:

    DJvodka

    Well-known member
  • Mar 31, 2009
    3,375
    292
    83
    A land like no other
    wada na bn :sorry: text file eke eka line ekak thibbama count eka hari . linees 2k wage pahalata yaddi count eka waradi.

    Code:
    private void button1_Click(object sender, EventArgs e) { 
    string[] allLines = System.IO.File.ReadAllLines("D:/test1.txt");
    string tf = "";
    int c = 0;
    foreach(string s in allLines)
    {
        tf += s;
        
    s = s.Replace(" ", ""); //Not sure if this works. Use a different var else
    c += s.Length;
    }
      textBox1.Text = tf;  string txt = textBox1.Text;    MessageBox.Show(c.ToString());  }
    PS: mama C# walin den code karanne ne. Code eka test karanna ide ekak wat ne :baffled:
     
    Last edited:

    DJvodka

    Well-known member
  • Mar 31, 2009
    3,375
    292
    83
    A land like no other
    I am asking this question in this tread is becouse lots of programmers talking here.

    I am a BIT(External) student in semester 5.currently i am developing my system using php.

    my question is after got BIT and if i choose PHP developer how much salary could i get after 1 year experiance.

    thanks you.:yes::yes:

    Personally I don't like php. It's still a scripting language, only good for small scale projects. (I don't mean to start a flaming war :P ). But the salary depends on the company and your skills. So if you only learn php, you won't get much far in terms of the salary.
     

    ilanganthilaka

    Well-known member
  • Jun 4, 2008
    12,435
    1,004
    113
    Personally I don't like php. It's still a scripting language, only good for small scale projects. (I don't mean to start a flaming war :P ). But the salary depends on the company and your skills. So if you only learn php, you won't get much far in terms of the salary.

    php small scale projects walata witharada ban use karanne. ethakota godakma powerfull server side language eka mokakda :oo: . mama nam asama php :cool:
     

    M E T H

    Active member
  • Oct 23, 2013
    647
    48
    28
    php small scale projects walata witharada ban use karanne. ethakota godakma powerfull server side language eka mokakda :oo: . mama nam asama php :cool:

    godak loku project waladi bohowita asp.net thamai use wenne but ekath honda naa. php unath hybrid widiyata yoda ganna puluwan. php , aps kiyanne interpretted language nisa echchara honda naa. loku project wala c, c++ core ekath ekka communicate karala dunawanna thamai php use karanne mokada itha ikmanin code eka edit karanna puluwan. core eka c/c++ compilation eka tikak wela yana deyakne... :yes:
     

    rhn123

    Well-known member
  • Jul 20, 2012
    759
    37
    48
    Code:
    private void button1_Click(object sender, EventArgs e) { 
    string[] allLines = System.IO.File.ReadAllLines("D:/test1.txt");
    string tf = "";
    int c = 0;
    foreach(string s in allLines)
    {
        tf += s;
        
    s = s.Replace(" ", ""); //Not sure if this works. Use a different var else
    c += s.Length;
    }
      textBox1.Text = tf;  string txt = textBox1.Text;    MessageBox.Show(c.ToString());  }
    PS: mama C# walin den code karanne ne. Code eka test karanna ide ekak wat ne :baffled:

    thanks machan help ekata man try karannam :cool: