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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:41:59+00:00 2026-05-16T17:41:59+00:00

For a specialized calculator I would like to allow copy / paste for a

  • 0

For a specialized calculator I would like to allow copy / paste for a textfield which is meant for numerical values only. So, only numerical characters should be actually pasted or the pasted string should be rejected if it contains non-numerical characters.

I was thinking about using UITextFieldDelegates textField:shouldChangeCharactersInRange:replacementString: method to check the pasted string for non-numerical characters. But NSString offers no method for checking whether it does NOT contain characters specified in a single set. So this way I would need to check occurances of characters from several sets, which is clumsy and these checks would run for every single number that would be typed in, which appears like quite some overhead to me.

Another way would be to iterate and check for every character in the replacement string whether there’s a match in a numerical set.

Either way would propably work, but I feel like I’m missing something.
Do you have any advice? Is there a convenience method to achieve 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-16T17:42:00+00:00Added an answer on May 16, 2026 at 5:42 pm

    But NSString offers no method for checking whether it does NOT contain characters specified in a single set

    sure it does.

    if([myString rangeOfCharacterFromSet:myCharacterSet].location ==NSNotFound) 
    {
    //means there is no character from specified set in specified string
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking for a pseudo random number generator which would be specialized to
I have developed some custom DAO-like classes to meet some very specialized requirements for
I have a specialized list that holds items of type IThing : public class
I am writing a very specialized app in C# that floats as a mostly
I want to make this specialized w/o changing main. Is it possible to specialize
The description of System.Collection.Specialized.HybridDictionary is this: Implements IDictionary by using a System.Collections.Specialized.ListDictionary while the
I'm currently working with a specialized, interpreted, programming language implemented in Java. As a
I've been strictly in a C++ environment for years (and specialized statistical languages). Visual
ApplicationSetting: RenameSettings - System.Collections.Specialized.StringCollection - User - *wall of text <Application x:Class=app.App ... xmlns:properties=clr-namespace:app.Properties
The Problem Our company make specialized devices running Windows XP (Windows XPe, to 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.