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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:59:11+00:00 2026-05-26T14:59:11+00:00

I am working on barcode app.So when user enter barcode in textfield so when

  • 0

I am working on barcode app.So when user enter barcode in textfield so when it match (-)insert in that string like this
let suppose textfield.text =12345786
so when it match it converted into 1234-5786
it is inserted but not deleting from my textfield.text value when my text is 123457869 or 1234578 dash(-)is not removing and textfield.text becomes 1234—-.
here is my code tell me where i am doing wrong?
NSMutableString *a = [NSMutableString stringWithString:textfield.text];

if([textfield.text floatValue]>=8 ){ 


    [a insertString: @"-" atIndex: 4];
    //textfield.text = [textfield.text stringByReplacingOccurrencesOfString:@"-" withString:@""];

    textfield.text = a;
    NSLog(@"in if");

}
  else if([textfield.text length]<8){


    //[a insertString: @"" atIndex: 4];
    textfield.text = [textfield.text stringByReplacingOccurrencesOfString:@"-" withString:@""];

    NSLog(@"in else");
    //NSRange range = {4,5};
    //[a deleteCharactersInRange:range];
    //textfield .text = a;
}
  • 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-26T14:59:12+00:00Added an answer on May 26, 2026 at 2:59 pm
    NSString *abc=@"12345678";
        NSString * a =[abc substringWithRange:NSMakeRange(0, 4)];
        NSString *b =[abc substringWithRange:NSMakeRange(0, 8)];
        abc =[NSString stringWithFormat:@"%@-%@",a,b];
        NSLog(@"%@",abc);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an app that requires a particular barcode true type font that
working with Flex4 AIR app, using this component I get data from the barcode
I'm working with a device (barcode printer) that can connect to a database to
I am working on an app for Android, but would like to have it
I am working on an app that reads QR codes and I need the
I'm working on a Windows Mobile 6.5 application that utilises a barcode scanner. I'm
I'm working on a small app where I can generate a list of barcodes.
Working with a SqlCommand in C# I've created a query that contains a IN
Working on a project that parses a log of events, and then updates a
Working in Eclipse on a Dynamic Web Project (using Tomcat (v5.5) as the app

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.