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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:09:01+00:00 2026-05-24T12:09:01+00:00

Whats the best way to authenticate and check the strings that a user enters

  • 0

Whats the best way to authenticate and check the strings that a user enters in a UITextField?

My workflow is as follows:
1) user launched view
2) view contains several UITexFields
3) user fills in data inside UIText fields
4) user clicks “save all” button
5) The strings inside the UITextFields are authenticated to see if they are acceptable
6) Activity Indicator is ongoing while authentication is taking place
7) Upon success view is popped off and info issaved
8) if unsuccessful, a UIActionsheet pops up and informs user which fields are incorrect and what the acceptable parameters are.

My question is this: Do I use regular expressions to authenticate the strings? If so are there any helpful tutorials or links for this purpose?

Here is the code:

-(IBAction)saveAllButtonPressed
{
    //Authenticate input ie: strings here
    //TO BE IMPLEMENTED

    if(!passedAuthentication)
       {
        //show UIActionsheet here

       }
    else //If passed authentication save everything and pop off the view 
       {
//sanitize input before storing in customer info model ie. take out dashes, strings etc..
        //TO BE IMPLEMENTED



        Cart.customerInfoObtained = YES;
        infoModel = [[customerInfoModel alloc] initWithObjects:self.Name.text
                                                         AptNo:self.AptNum.text
                                                       Street1:self.Street1.text
                                                       Street2:self.Street2.text
                                                          City:self.City.text
                                                           Tel:self.Telephone.text
                                                         Email:self.Email1.text]; 
[Cart addCustomerInfo:infoModel];
   }

}
  • 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-24T12:09:01+00:00Added an answer on May 24, 2026 at 12:09 pm

    I’m not sure what you are trying to authenticate in the text, but with iOS 4.0, there’s a class for regular expressions in Objective C (documentation). Depending on what you are looking for when you authenticate regex may or may not be the best way. For example, if you want to make sure the string only has alphanumeric characters, you could do:

    NSCharacterSet *alphaSet = [NSCharacterSet alphanumericCharacterSet];
    BOOL valid = [[MY_STRING stringByTrimmingCharactersInSet:alphaSet] isEqualToString:@""];
    

    This method checks the string and removes all characters found in the NSCharacterSet- then if the string produced has no characters, there were no unexpected characters. You can create your own NSCharacterSets so this might be an easier way to validate compared to regular expressions.

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

Sidebar

Related Questions

Whats the best way to check if a username exists in a MySQL table?
Whats the best way to convert int's, long's, double's to strings and vice versa
What's the best way to authenticate and track user authentication state from page to
What is the best way to do authenticate and authorize webapp request in Tomcat
Whats the best way to read/write file properties (like author, description, etc) in C#?
Whats the best way to go about upgrading a project with major design changes...in
Whats the best way to zip up files using C#? Ideally I want to
Whats the best way to get the current time (HH:MM:SS) using Objective-C. I would
whats the best way to get Statistics Web pages by the users visited ?
Whats the best way in Ruby to do something like my_array.select(n){ |elem| ... }

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.