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

  • SEARCH
  • Home
  • 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 8861723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:33:16+00:00 2026-06-14T15:33:16+00:00

I am trying to split my current applications version number, but is removes the

  • 0

I am trying to split my current applications version number, but is removes the leading zeros.

How do i change my split to not remove the leading zeros.

Getting the currentVersionNo:

startUpAssembly.GetName().Version.ToString()

So for testing:

string versionNo = "7.01.7000.0";

string[] versionInfo = versionNo.Split('.');

This produces:

7
1 //Here i need it to be 01
7000
0

And i need it to NOT remove the leading zero. How do i achieve this?

Maybe there is a better solution using regex?

  • 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-14T15:33:18+00:00Added an answer on June 14, 2026 at 3:33 pm

    A System.Version isn’t an arbitrary string – it’s four integers. Leading zeroes are irrelevant, so not included when converting back to a string. That’s where you’re losing information – not in String.Split. You can see this very easily:

    using System;
    
    class Test
    {
        static void Main()
        {
            Version version = new Version("7.01.7000.0");
            Console.WriteLine(version); // 7.1.7000.0
        }
    }
    

    Basically, your plan is fundamentally flawed, and you should change your design. You shouldn’t be trying to represent a version of “7.01.7000.0” to start with.

    Additionally, you should take a step back and think about your diagnostic procedure: what made you think that String.Split was to blame here? Why wasn’t your first step looking at the result of startUpAssembly.GetName().Version.ToString()?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to split a string on its punctuation, but the string may contain
I'm trying to split a string into a int list for further processing. But
I'm trying to create a Regex javascript split, but I'm totally stuck. Here's my
I am trying to split my current Ruby on Rails 3 web-application and it's
I am trying to convert some vb.net to C#, but I keep getting errors.
I'm trying to split strings in half, and it should not split in the
After getting the current word with expand(<cWORD>) and processing the result string, I'm trying
Trying to split this string 主楼怎么走 into separate characters (I need an array) using
I am trying to split a string in javascript . it works fine in
I'm trying to split strings in C# like this COMMSTR1-NAC-NAM-P-C FCPANAM1-NAC-NAM-P-C CHAZEL1-NAT-CBM-P-C should be

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.