Jump to content
View in the app

A better way to browse. Learn more.

Obsidian Forum Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

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!

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

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!


 

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

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!


 

Please Help. I wrote a C# program

 

I found your problem.

Show us line. All in your editor see if you can set a view of hex for the line string so we can be sure of all the characters.

redacted

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

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!


 

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

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

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

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

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?

(Signatures: disabled) 

  • 3 weeks later...

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

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

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

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

Check this one

 

string str = null;

string[] strArr = null;

int count = 0;

str = "CSharp split test";

char[] splitchar = { ' ' };

strArr = str.Split(splitchar);

for (count = 0; count < = strArr.Length - 1; count++)

{

MessageBox.Show(strArr[count]);

}

 

http://csharp.net-informations.com/string/csharp-string-split.htm

 

maaki.

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.

redacted

  • 3 weeks later...
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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.