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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:18:01+00:00 2026-06-07T16:18:01+00:00

I am working on an iOS app that uses FMDB to store a list

  • 0

I am working on an iOS app that uses FMDB to store a list of books with titles that must be sorted alphanumerically (alpha first, numbers second). However, I must also ignore a non-alphanumeric leading character such as an asterisk or a parenthesis. I must also ignore “The”. In addition, this sorted data will be displayed on an indexed UITableView so I need to be able get a list of the leading characters and the number of book titles that go into each section.

Example-

This is a list of book titles:

"A Title 1", "A Title 2", "The A Title 3", "B Title 1", "B Title 2", "B Title 3", 
"*B Title 4", "C Title 1", "(The) C Title 2", "3 Title 1"

From this list I would count 4 sections to put the titles in (‘A’, ‘B’, ‘C’, ‘3’). I would also count the number of books that go into each section (‘A’-3 books, ‘B’-4 books, ‘C’-2 books, ‘3’-1 book). Using this tutorial I was able to set up the sections and indexing but am having trouble dealing with titles like “The A Title 3”, “*B Title 4”, and “(The) C Title 2”.

Currently, this this the statement I am using:

SELECT DISTINCT UPPER(SUBSTR(BookTitle, 1, 1)) AS Section, 
COUNT(BookTitle) AS SectionCount 
FROM BookTable 
GROUP BY Section ORDER BY IFNULL(Section + 1, 0), Section

This returns a list of sections sorted alphanumerically and the number of books that go into each section. The issue is that my ‘T’ section has far too many books in it because it is getting all books with “The” as the leading characters. Not to mention I am getting sections for special characters like < or * when I would like to ignore these. I am thinking that I need to trim off any non-alphanumeric characters and any occurrence of “The ” but I don’t know how integrate it into my query as it is now.

I hope this is detailed enough. Please feel free to ask me to clear up anything. As always, thanks in advance.

  • 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-07T16:18:03+00:00Added an answer on June 7, 2026 at 4:18 pm

    The best option might be to check for these conditions on insert, and put “The” at the end of the title (eg, “A Title 3, The”). You can write a simple program to update the current database and mote “The” to the end.

    But if you really want to keep it this way, look into case expressions. Here is a related topic:
    Does sqlite support any kind of IF(condition) statement in a select

    Basically, check the case for “The” or special characters, and use that case in your SUBSTR.

    • 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 iOS app that uses a NSMutableURLRequest and a NSURLConnection to
I'm working on a universal app that uses the camera on iOS devices and
I’m working on an app with an AIR3 iOS native extension that uses Accelerate.framework
I'm working on an iOS app that uses an NSTimer for a countdown. This
I am working on an iOS app that uses NSURL to consume XML data
I am working on a sports app that uses GPS and OpenEars text-to-speech. The
I am working on an iOS app that needs to retrieve information about what
I am working on an iOS app that I want to stream photos/pics in
Newbie error? Im working on a quiz app that uses answer results from a
I'm working on an app that uses a jQuery UI plugin, which in turn

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.