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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:36:32+00:00 2026-06-16T21:36:32+00:00

I have a string which gives the Date (below) NSString*str1=[objDict objectForKey:@date]; NSLog(@ str values2%@,str1);

  • 0

I have a string which gives the Date (below)

NSString*str1=[objDict objectForKey:@"date"];

 NSLog(@" str values2%@",str1); --> 04-Jan-13

Now Problem is I need to Trim the"-13" from here .I know about NSDateFormatter to format date.but I can’t do that here.I need to trim that

For that I am using:-

 NSCharacterSet *charc=[NSCharacterSet characterSetWithCharactersInString:@"-13"];

 [str1 stringByTrimmingCharactersInSet:charc];  

But this does not work.this does not trim…how to do that..help

  • 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-06-16T21:36:33+00:00Added an answer on June 16, 2026 at 9:36 pm

    But this does not work.this does not trim…

    It does trim, but since NSString is immutable, the trimmed string is thrown away, because you do not assign it to anything.

    This would work (but do not do it like that!)

    str1 = [str1 stringByTrimmingCharactersInSet:charc];
    

    What you do is not trimming, it’s taking a substring. NSString provides a much better method for that:

    str1 = [str1 substringToIndex:6]; // Take the initial 6 characters
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have javascript date object which gives me a date string in this format,
I have javascript date object which gives me a date string in this format,
I have an events object which is given below NSString *name; NSString *date; NSInteger
I have a string which has the below content String msg = The variables
Hi I have made a code which gives me an url with a date
I have a string which is of about 1mb size. The requirement is to
I have a string which is in the following format, When there is a
I have a string which varies everytime it is input as it is a
I have a string which is a representation of a clojure map. Is there
I have a string which typically is in the format : 0xFF . I'll

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.