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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:09:36+00:00 2026-05-27T11:09:36+00:00

tIs it possible for me to detect if a string is ‘all numeric’ or

  • 0

tIs it possible for me to detect if a string is ‘all numeric’ or not using tr1 regex?
If yes, please help me with a snipped as well since I am new to regex.

Why I am looking towards tr1 regex for something like this, because I don’t want to create a separate function for detecting if the string is numeric. I want to do it inline in rest of the client code but do not want it to look ugly as well. I feel maybe tr1 regex might help. Not sure, any advises on 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-05-27T11:09:36+00:00Added an answer on May 27, 2026 at 11:09 am

    If you just want to test whether the string has all numeric characters, you can use std::find_if_not and std::isdigit:

    std::find_if_not(s.begin(), s.end(), (int(*)(int))std::isdigit) == s.end()
    

    If you do not have a Standard Library implementation with std::find_if_not, you can easily write it:

    template <typename ForwardIt, typename Predicate>
    ForwardIt find_if_not(ForwardIt first, ForwardIt last, Predicate pred)
    {
        for (; first != last; ++first)
            if (!pred(first))
                return first;
    
        return first;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure if this is possible in Delphi. I've looked around and can't
Is it possible to create a List or IEnumerable using GetType(). // If T
I want to use passed template parameter as string. Is it possible? T is
How to iterate a UTF-8 string character by character using indexing? When you access
Is it possible to create a new List<T> where the T is dynamically set
I was trying to use tis depencency property in my code but it gives
For example, suppose I'm editing following text (\t is for tabs, it's not text)
in .net, if I have a generic class SomeClass<T> , is it possible to
Is it possible to create a function which accepts it's parent object as a
I have a class: public class MyClass<T> { public string TestProperty { get; set;

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.