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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:26:35+00:00 2026-05-26T13:26:35+00:00

I am trying to make a simple markup language, and I need my Cocoa

  • 0

I am trying to make a simple markup language, and I need my Cocoa app to be able to read it. I would prefer to have that code written in Objective-c, but I am happy to use any other language.

Here is my current problem. I am using this code:

for (int character = 1; character < ([script length] - 1); character ++) {
    NSLog(@"%@", [[script substringToIndex:character] substringFromIndex:([[script substringToIndex:character] length] - 2)]);

Unfortunately, if I pass the string [button] through it, it shows this in the debug console:

[
[b
[bu
[but
[butt
[__NSCFConstantString substringWithRange:]: Range or index out of bounds

I can sort out the error message, but I need to know how to read the script and recognize certain tags like [button]. Can anybody give me a link to something useful on this subject?

  • 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-26T13:26:36+00:00Added an answer on May 26, 2026 at 1:26 pm

    Just to give you examples:

    NSString *str = @"[Button]";
    NSUInteger i, len = [str length];
    
    for (i = 1; i <= len; ++i)
        NSLog(@"%@", [str substringToIndex:i]);
    
    for (i = 0; i < len; ++i)
        NSLog(@"%c", [str characterAtIndex:i]);
    

    Output:

    [
    [B
    [Bu
    [But
    [Butt
    [Butto
    [Button
    [Button]
    [
    B
    u
    t
    t
    o
    n
    ]
    

    And a more interesting case:

    for (i = 0; i < len; ++i)
        NSLog([NSString stringWithFormat:@"%%%dc", i+1],
              [str characterAtIndex:i]);
    

    Which produces:

    [
     B
      u
       t
        t
         o
          n
           ]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a meta-language for writing markup code (such as xml and
I am trying to make simple app that allows one to compare image to
I'm trying to make simple animation that would repeat several times (or infinitely). It
Im trying to make a simple app (just for learning sake) that will be
Trying to make simple minesweeper game in python, but have one problem. I have
I'm trying to make a simple C# web server that, at this stage, you
I'm trying to make a simple drawing app in c++, but i'm having trouble
I'm trying make my first python app. I want make simple email sender form.
I'm trying to make simple many-to-one association, using NHibernate.. I have class Recruit with
I am trying to make simple regex that will check if a line is

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.