Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Baseus PI LITE INDOOR CAMERA
ErMurazor
Updated:
Yesterday at 12:26 PM
Ad icon
Colombo
Hard Disk For Sale
mazza
Updated:
Saturday at 10:23 PM
land for sale
justasking
Updated:
Saturday at 9:32 AM
AMD AM 5 Ryzen setup
prabodhamadusanka
Updated:
Thursday at 12:56 PM
Gampaha
ACER OKW223 Wired RGB Keyboard
chint
Updated:
Thursday at 10:17 AM
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
C# string to array
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="rhn123" data-source="post: 15962525" data-attributes="member: 409743"><p>machan mekai mata string count ekak hadanna one. mata one fiue textbox ekakata load karan eke character count eka ganna one. string eke length aran eken thiyena spaces adu karala. 1d array eken karata ms word ekak wage load karama hama dimension ekakma thiyena string cnt wenna 2d array ona neda bn?</p><p></p><p>mage danata code eka meka</p><p></p><p>private void button1_Click(object sender, EventArgs e)</p><p>{</p><p>string file = "D://test1.txt";</p><p>System.IO.StreamReader obj = new System.IO.StreamReader(file);</p><p>string[,] box = textBox1.Text;</p><p>box = obj.ReadToEnd();</p><p>int count = box.Length;</p><p>int rea = 0;</p><p>int spaces = 0;</p><p>for (int i = 0; i < box.Length; i++)</p><p>{</p><p>for (int j = 0; j < box.Length; j++)</p><p>{</p><p>if (box[i,j].Equals(" "))</p><p>{</p><p></p><p>spaces = spaces + 1;</p><p>}</p><p></p><p>}</p><p>}</p><p>rea = count - spaces;</p><p>MessageBox.Show(rea.ToString());</p><p></p><p>} </p><p>}</p></blockquote><p></p>
[QUOTE="rhn123, post: 15962525, member: 409743"] machan mekai mata string count ekak hadanna one. mata one fiue textbox ekakata load karan eke character count eka ganna one. string eke length aran eken thiyena spaces adu karala. 1d array eken karata ms word ekak wage load karama hama dimension ekakma thiyena string cnt wenna 2d array ona neda bn? mage danata code eka meka private void button1_Click(object sender, EventArgs e) { string file = "D://test1.txt"; System.IO.StreamReader obj = new System.IO.StreamReader(file); string[,] box = textBox1.Text; box = obj.ReadToEnd(); int count = box.Length; int rea = 0; int spaces = 0; for (int i = 0; i < box.Length; i++) { for (int j = 0; j < box.Length; j++) { if (box[i,j].Equals(" ")) { spaces = spaces + 1; } } } rea = count - spaces; MessageBox.Show(rea.ToString()); } } [/QUOTE]
Insert quotes…
Verification
Awruddata maasa keeyada?
Post reply
Top
Bottom