Jump to content

Recommended Posts

Posted

C# Split String Is Not Working

======================

 

Please Help. I wrote a C# program that reads code one line at a time. Each line has data seperated by tabs.

 

Here is what my C# code is supposed to do. The line is supposed to be split into a string array by using the "Split" string methodIt is supposed to be spit read in text one line at a time and I use the "Split" method to group the line according to the tab character.

 

But, as this screen shot shows, it does not work. Any idea why?

 

problem.png

Posted

It may be a syntax problem.

 

Maybe try something like:

 

string[] arr = line.Split(new char [] {'\t'});

Swedes, go to: Spel2, for the latest game reviews in swedish!

Posted

Go go mkreku, I thought you couldn't code.

  • Like 1

I came up with Crate 3.0 technology. 

Crate 4.0 - we shall just have to wait and see.

Down and out on the Solomani Rim
Now the Spinward Marches don't look so GRIM!


 

Posted

Are you sure it's tabs in the string and not spaces ?

Why has elegance found so little following? Elegance has the disadvantage that hard work is needed to achieve it and a good education to appreciate it. - Edsger Wybe Dijkstra

Posted

Are you sure it's tabs in the string and not spaces ?

 

It's a matter of being certain what the delimiter should be, t, or n or a symbol. I tend to use a symbol so I can be explicit.

I came up with Crate 3.0 technology. 

Crate 4.0 - we shall just have to wait and see.

Down and out on the Solomani Rim
Now the Spinward Marches don't look so GRIM!


 

Posted

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace LineSplit
{
   public partial class Form1 : Form
   {
    public Form1()
    {
	    InitializeComponent();
    }
    private void button1_Click(object sender, EventArgs e)
    {
	    richTextBox1.Clear();
	    string inputLine = textBox1.Text;
	    string[] lines = inputLine.Split('\t');

	    foreach(string line in lines) {
		    richTextBox1.AppendText("\n"); // skips a line
		    richTextBox1.AppendText(line);
	    }

    }
    private void button2_Click(object sender, EventArgs e)
    {
	    textBox1.Text += '\t';
    }
   }
}

 

fBhiu.png

http://i.imgur.com/fBhiu.png

 

Works for me. Are you using mono?

redacted

Posted
Please Help. I wrote a C# program

 

I found your problem.

 

You're not still evangelising Python, hell next you'll tell me you think Javascript is awesome.

 

C++ or fail dude.

I came up with Crate 3.0 technology. 

Crate 4.0 - we shall just have to wait and see.

Down and out on the Solomani Rim
Now the Spinward Marches don't look so GRIM!


 

Posted

Language snobbery is so undergrad. Still though, really should get back practicing my C++ and C#.

  • Like 1

Why has elegance found so little following? Elegance has the disadvantage that hard work is needed to achieve it and a good education to appreciate it. - Edsger Wybe Dijkstra

Posted (edited)
Please Help. I wrote a C# program

 

I found your problem.

 

You're not still evangelising Python, hell next you'll tell me you think Javascript is awesome.

 

C++ or fail dude.

 

Eh, go away. Nobody takes you seriously anyway. Still, you accidentally stumbled upon a grain of wisdom. "C++ or fail" indeed. In this case the OP chose fail.

 

P.S. Javascript is pretty annoying, but maybe if you try Coffeescript you'll still be a douchebag, but at least you'll be a douchebag using a nice language. What, are you going to tell me people should code interactive websites in C++? lol

 

Language snobbery is so undergrad. Still though, really should get back practicing my C++ and C#.

 

And yet it's what Ph.Ds and industry veterans will often spend their time writing papers on.

 

In this case, Microsoft themselves have rapidly ditched C# in favour of a return C++ for the cases where they were using it (which were cases where they used C++ originally anyway - turns out C# isn't a suitable replacement). This is poignant because Microsoft are the ones who designed C# in the first place, and for this main purpose (to replace C++ internally).

 

Anybody still using C# in light of this is just unaware of better languages for their needs - C++ and Python for instance, depending on the solution required.

Edited by Krezack
Posted

They spend their time sneering at other languages ? :p

 

Wonder if the guy fixed his problem though, which was getting this function to work as intended.

Why has elegance found so little following? Elegance has the disadvantage that hard work is needed to achieve it and a good education to appreciate it. - Edsger Wybe Dijkstra

Posted

Lots of ideas here. That's what he asked for. Maybe the reason why the split doesn't work is because those four options are getting along so well, that they just don't want to be split.. Maybe they are currently discussing what ruleset they should use for their next adventure.. I suggest making a check for tabs before trying to split a string based on that. Make a regular expression and check to see if there any tabs in there or possible multiple spaces and apply the split based on what the result is. Could be tabs, could be spaces.. could it be love?

  • Like 1

(Signatures: disabled) 

  • 3 weeks later...
Posted
Please Help. I wrote a C# program

 

I found your problem.

 

You're not still evangelising Python, hell next you'll tell me you think Javascript is awesome.

 

C++ or fail dude.

 

>Insinuating C++ is the king of all languages

>2012

 

Yeah I know no green text here.

 

I could equally say to you

 

ASM or fail dude.

 

But I am sure that you may lie about knowing ASM fully just like your claim to invent the crate 3.0 technology which is car engine tech, which wasn't invented by a Swedish man, just sayin' :p

Posted

What languages does Obsidian use? Just LUA and C++?

 

The games that have used Onyx consist of this: The engine is C++. Our tools are a combination of C++ and C# (all of our development is done using Windows machines). And our UI utilizes Actionscript (Flash).

 

I cannot say exactly what other languages besides C++ the projects before DS3 used but, the primary language of all of our released games has been C++.

Twitter: @robyatadero

Posted

Alpha protocol was made using Unreal, so we used C++ and unreal script.

Fallout New Vegas was made using Gambryo -- programmers worked almost exclusively in C++ (including tools work), though some XML work was required for UI.

Roby already went into Onyx projects.

https://twitter.com/IridiumGameDev

Ex-Obsidian Senior Programmer

Posted

Dear persons who posted here, Why I should work for you:

 

Your CEO seems cool.

Your developers are passionate (a big plus)

I enjoy Obsidian's CV.

I enjoy C++.

I have never had a job, so I would know best what it feels like to be off task.

I am a decent 3D artist. This includes sculpting characters , extruding faces, adding edge loops, and texturing, rigging, animating the result.

  • Like 1

redacted

  • 3 weeks later...
Posted (edited)
Please Help. I wrote a C# program

 

I found your problem.

 

You're not still evangelising Python, hell next you'll tell me you think Javascript is awesome.

 

C++ or fail dude.

 

>Insinuating C++ is the king of all languages

>2012

 

Yeah I know no green text here.

 

I could equally say to you

 

ASM or fail dude.

 

But I am sure that you may lie about knowing ASM fully just like your claim to invent the crate 3.0 technology which is car engine tech, which wasn't invented by a Swedish man, just sayin' tongue.png

 

*sigh* ... Really... Nice try.

Edited by Nightshape

I came up with Crate 3.0 technology. 

Crate 4.0 - we shall just have to wait and see.

Down and out on the Solomani Rim
Now the Spinward Marches don't look so GRIM!


 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...