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 8666535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:45:26+00:00 2026-06-12T17:45:26+00:00

I have a a string containing this text… BEGIN Fin Bal -461.000 Day 4

  • 0

I have a a string containing this text…

BEGIN Fin Bal -461.000 Day 4 END

BEGIN Fin Bal 88861.000 Day 2 END

BEGIN Fin Bal 456461.000 Day 1 END

BEGIN Fin Bal -44561.000 Day 0 END

I need to extract the value

-461.000

Including if its negative or not.

I have been using this…

static string ExtractNumbers(string expr)
{
    //removes all text from string
    return string.Join(null, System.Text.RegularExpressions
                 .Regex.Split(expr, "[^\\d]"));
}

Problem is this removes the negative symbol and also keeps the 4 from the day value.

Is there any way to get the numeric value after the word Bal efficiently? Excluding any text after the wanted value?

Thanks, Paul.

  • 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-12T17:45:27+00:00Added an answer on June 12, 2026 at 5:45 pm

    For a LINQ solution which grabs the first number:

    string str = "BEGIN Fin Bal -461.000 Day 4 END";
    decimal d;
    string n = str.Split(' ').Where(s => decimal.TryParse(s, out d)).FirstOrDefault();
    Console.WriteLine(n == null ? "(none)" : decimal.Parse(n).ToString());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this string containing a large chunk of html and am trying to
I have a string containing something like this Hello bla bla bla bla ok,
If I have code like this: string s = MyClass.GetString(); // Returns string containing
I have a string containing lots of text with white-spaces like: String str =
I have a String variable containing text file (such as .html) using fopen() and
Suppose I have a string such as this in a text file: (((var1 AND
Sorry for this extreme beginner question. I have a string variable originaltext containing some
I have a variable string text containing lets say ABCDEFGHIJKL. I want to trim
I have a string like this: This is a {{text}} for {{testing}} PHP {{regular
I have this string containing a date I need to parse to get 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.