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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:03:59+00:00 2026-05-31T09:03:59+00:00

I am a novice in Programming and have just started Objective C. I have

  • 0

I am a novice in Programming and have just started Objective C. I have created a text field in which I want to allow a “.” to be entered only once! From what I understand, rangeOfString should be able to do this.

-(IBAction)floatingPoint:(UIButton *) sender {

    NSString *floatingPoint = [sender currentTitle];
    NSRange range = [floatingPoint rangeOfString:@"."];

    if (range.location == NSNotFound) {
        self.display.text = 
            [self.display.text stringByAppendingString:floatingPoint];
    }
}

From what I understand the code floatingPoint rangeOfString:@”.” would check for “.” in currentTitle and if it is not found should append this string with a “.”

But this is not happening, no decimal point is being entered. If I enter only
self.display.text = [self.display.text stringByAppendingString:floatingPoint];
then the text field allows more than 1 decimal points to be entered.
Sorry if I described the problem incorrectly, I am new to all this stuff and this has just begun to sink in.

  • 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-31T09:04:01+00:00Added an answer on May 31, 2026 at 9:04 am

    You’re checking the button’s title for a .. You probably set the button’s title to . in your nib, so of course it always contains a .!

    You need to check your text field’s text for a . instead. Try this:

    NSRange range = [self.display.text rangeOfString:floatingPoint];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a novice in iOS programming and I have some novice questions. I
I am novice in sharepoint programming. I have a following code: SPWorkflowTask task =
Consider me a novice to Windows environment and COM programming. I have to automate
I am a novice to Java programming using Netbeans. I have added jCalendar to
I'm still a graphics programming novice and bet the following problem is just a
I've been programming badly for quite a while and I only really just realised.
Hello friends a very novice question as I am very new to programming. I
Python novice here. I am using python2.7.2 on Windows7. I have installed the PyWin32
I am a novice to Oracle DBMS and I have a task to change
I am totally a novice in Multi-Core Programming, but I do know how to

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.