Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8281911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:11:56+00:00 2026-06-08T10:11:56+00:00

I currently got a problem with RCon. I am basically sending a request to

  • 0

I currently got a problem with RCon.
I am basically sending a request to receive a list of all players.
The server answers with a list of all players like this:

#     IP:Port      Ping    ID          Name
0     127.0.0.1    0       3523523     Bob
12    192.168.0.1  120     342525523   Anna
320   192.168.0.2  240     63463634634 Chuck Norris
   ^^^           ^^   ^^^^^           ^

The problem is, I do not know how many spaces are between the different tags, it depends on how long the #/IP/ping and ID is.
The spaces can differ from 1 space to 5 spaces.
Also there can be spaces in the name so I can’t just split with one space.

I want to read the IP, ping, id and name from the list.
I currently try to do some messy replace & split stuff but it just doesn’t work out when the spaces are different.
I thought about doing something with regex but I am not so good with regex.
I already split the lines to cut it down to 1 line.
The class Player can store all the informations

Here is what should happen:

        // List to store all the players
        List<Player> players = new List<Player>();
        // Using a StringReader to split up every line
        StringReader reader = new StringReader(result);

        string line;
        int row = 0;
        // Processing every line one after another
        while ((line = reader.ReadLine()) != null)
        {
            row++;
            // Doing some filtering to prevent empty lines and other stuff
            if (row > 3 && !line.StartsWith("(") && line.Length > 0)
            {
                // Getting all the stuff I need here
                // Then adding a player object to save the informations, ignore status
                players.Add(new Player(ip, ping, id, name, status));
            }
        }

Anyone got an idea that could solve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T10:11:57+00:00Added an answer on June 8, 2026 at 10:11 am

    Simplest way would be to split your line into 5 parts

    var items = line.Split(new char[] {' '}, 5, StringSplitOptions.RemoveEmptyEntries);
    players.Add(new Player(items[1], items[2], items[3], items[4], "status?"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I'm deal with a history message page using Cakephp.And I got a problem
My problem currently is that I've got a project on bitbucket, and I've been
I'm currently preparing a major Program-Update and ran into following problem: I've got a
ok i got this problem. i have this routes: (code bit change) File:/home/dotcloud/current/config/routes.js exports.routes
I've got a problem querying the message count from the remote msmq queue. This
I got this problem with TFS, I connected to the wrong network and tried
I've got a problem with this query....or, not yet as much as I will
i've got a Problem with my Phone. I'm currently programing an Android App with
we are currently evaluating JPA for our persistence unit and we got a problem
I've got a problem which I can't seem to solve. I'm currently implementing a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.