SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Addict m2k's Avatar
    Join Date
    Oct 2003
    Location
    Philadelphia
    Posts
    209
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help sorting uppercase/lowercase names with equal value

    I'm using a script to convert record tables in an HTML file to be client-side sortable by associating title columns with sort events.

    Page: http://www.faimer.org/education/fellows/index.html

    It works fine when sorting by last name, except for those which start with a lowercase letter (van, de, etc.). I understand ASCII considers uppercase before lowercase letters, so is there an easy fix to this?

    thanks.

  2. #2
    SitePoint Guru
    Join Date
    Sep 2006
    Posts
    731
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by m2k View Post
    url]

    It works fine when sorting by last name, except for those which start with a lowercase letter (van, de, etc.). I understand ASCII considers uppercase before lowercase letters, so is there an easy fix to this?
    Just modify the compare function, so that it performs a case-insensitive comparison, by converting both items to lowercase before comparing. You'll have to decide how you want to treat numeric cells if there are to be any.
    Tab-indentation is a crime against humanity.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •