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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:24:18+00:00 2026-05-27T04:24:18+00:00

I am trying to write a bit of code to take a string (this

  • 0

I am trying to write a bit of code to take a string (this string automatically changes based on the day of the week), parse this string into chars, and retrieve the chars in order at certain points. Here’s how it would need to be used:

if (DateIsBetween(aPeriodMWF, legitDate, bPeriodMWF)) period=aPeriod;
    if (DateIsBetween(bPeriodMWF, legitDate, cPeriodMWF)) period=bPeriod;
    if (DateIsBetween(cPeriodMWF, legitDate, dPeriodMWF)) period=cPeriod;
    if (DateIsBetween(dPeriodMWF, legitDate, ePeriodMWF)) period=dPeriod;
    if (DateIsBetween(ePeriodMWF, legitDate, fPeriodMWF)) period=ePeriod;
    if (DateIsBetween(fPeriodMWF, legitDate, gPeriodMWF)) period=fPeriod;
    if (DateIsBetween(gPeriodMWF, legitDate, aPeriodMWF)) period=gPeriod;

    if (period==1) {
        if(parsedCharacter='A') nextPeriodLabel.text="A Period Class";
        //repeat for parsedCharacter = b,c,d,e,f,g
    }

    if (period==2) {
        //Do the same thing, but get the second character in the string   
    }

In this code, “parsedCharacter” needs to reflect the first character in the sequence. In the next statement however, it will have to reflect the next character in the string.
Here is the code for getting the strings:

if (currentWeekType == 1) {
    if ([weekDay isEqualToString:@"Wednesday"]) sequenceString = @"ABCDEF";
    if ([weekDay isEqualToString:@"Friday"]) sequenceString = @"DGCFEAB";
}
  • 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-27T04:24:18+00:00Added an answer on May 27, 2026 at 4:24 am

    To retrieve the individual characters you could use [myString characterAtIndex:i] where i is the index within the string. Depending on your need you could either hardcode the index numbers or use a counter variable to increment it (and thus getting the next character). Of course you could also copy your NSString into an NSMutableString and remove the first character after extracting a character but this is probably a lot slower than using an index variable. Beware of running over the end of the string though (larger index than string size).

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

Sidebar

Related Questions

I am trying to write unit tests for a bit of code involving Events.
I am trying so write a bit of code that will search for a
I'm trying to write a bit of code which sends a single int over
I am trying to write this code: for (i = 0; i <= CONST
I'm trying to write a bit of code to login to a website. But
I'm trying to write out a bit of code for the gradient descent algorithm
I'm learning java and have a bit of code I am trying to write
I've been messing with this bit of code for over an hour trying to
I'm trying to write an application that converts 48 bit-per-pixel PNG files to a
I am new to php and trying to write a login function. Bit stuck

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.