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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:01:22+00:00 2026-05-31T00:01:22+00:00

my string is 37829300. How can I space out every 2 characters in the

  • 0

my string is “37829300”.

How can I space out every 2 characters in the string so the result can be “37 82 93 00”.

I am trying to achieve this in vc++.

Thanks.

I understand I may have to use #include iostream but I am lost on how to do it properly.

  • 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-05-31T00:01:23+00:00Added an answer on May 31, 2026 at 12:01 am

    Couldn’t find a fancy one-liner regular-expression, so let’s do it the manual way.

    private static string AddSpaceAfterTwoDigits(string input)
    {
        string output = string.Empty;
        MatchCollection arr = Regex.Matches(input, @"\d\d");
        if ( arr.Count > 0 )
        {
            output = arr[0].Groups[0].Value; // Add the first with no space
    
            for ( int i = 1; i < arr.Count; i++ )
            {
                output += " " + arr[i].Groups[0].Value;
            }
        }
    
        return output;
    }
    
    • The code is in C#, but it’s a fairly straight-forward conversion to C++/CLI.
    • The code assumes an input of an even number of digits.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

String 2011-05-19 10:30:14 To Thu May 19 10:30:14 UTC 2011 How can I convert
string percentage = e.Row.Cells[7].Text; I am trying to do some dynamic stuff with my
String's in C# are immutable and threadsafe. But what when you have a public
string x; foreach(var item in collection) { x += item+,; } can I write
string s = <script type=text/javascript src=/stepcarousel.js></script> How can I get the data inside the
string abc = This is a string; How do I load abc into a
String str = new String(Hello); Normally I have read, in many articles available on
String a=aaa; String b=bbb; String c=ccc; String d=ddd; String p,q,r,s; How can I assign
string tags = 9,3,12,43,2 List<int> TagIds = tags.Split(','); This doesn't work cause the split
String data=this we want append in that file; byte[] getbyte = data.getBytes(); outputstream.write(getbyte); outputstream.flush();

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.