473,387 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

order but lowercase how uppercase

if use this function here array.sort(compare)
function compare(a,b){
a=a.toLowerCase();
b=b.toLowerCase();
if (a<b) return -1;
if (a>b) return 1;
return 0;
}

not work; error is toLowerCAse isn't a function;

if I have this list:
autoveicle
house
bicycle
HOUSE

it sort so:
HOUSE
autoveicle
bicycle
house

in the first position there is the upper;
is possible to have so:? (normal alphabetical ordering how in windows )
autoveicle
bicycle
house
HOUSE
May 26 '07 #1
1 1811
artev wrote:
if use this function here array.sort(compare)
function compare(a,b){
a=a.toLowerCase();
b=b.toLowerCase();
if (a<b) return -1;
if (a>b) return 1;
return 0;
}

not work; error is toLowerCAse isn't a function;

if I have this list:
autoveicle
house
bicycle
HOUSE

it sort so:
HOUSE
autoveicle
bicycle
house

in the first position there is the upper;
is possible to have so:? (normal alphabetical ordering how in windows )
autoveicle
bicycle
house
HOUSE
Perhaps the function is being passed something that is not a string?
May 27 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Steve | last post by:
I have a query which filters records containing uppercase and Lowercase i.e. Smith and SMITH, Henderson and HENDERSON etc. Is there a way that I can filter only those records that contain the...
3
by: Steve | last post by:
I have a query which filters records containing uppercase and Lowercase i.e. Smith and SMITH, Henderson and HENDERSON etc. Is there a way that I can filter only those records that contain the...
1
by: The_Kingpin | last post by:
Hi all, I need to make a function that convert a string into a certain format. Here what are the restriction: -The first letter of the first and last name must be uppercase. -If a first name...
30
by: Steve Edwards | last post by:
Hi, I'm re-writing some code that had relied on some platform/third-party dependent utility functions, as I want to make it more portable. Is there a standard C/C++/stl routine for changing an stl...
2
by: evantri | last post by:
Hi everyone, I am required to write a standard C function to import the single character variable and return the lowercase version of the character int upper_to_lower ( char singlecharacter ) {...
2
by: t8ntboy | last post by:
I have a table the contains field called PersonID. Each record in the personID field begins with the letter "p" in uppercase or lowercase. I want to run a query that finds all of the lowercase...
14
by: fniles | last post by:
In VB.NET 2005 can I check if a letter in a string is upper case or lower case ? For example: I have the following 2 lines: NQ,Z2003,11/11/2003,1416.5,1420,1402,1411.5...
9
by: humaid | last post by:
hi guys,i have this problem.first let me show you the so far code #!/user/bin/perl while ($a = <STDIN>) { if ($a =~ tr/A-Z/a-z/) { print "$a\n"; }
1
by: gsreenathreddy | last post by:
Hi! <html> <head> <script type="text/javascript"> function upperCase() { var x=document.getElementById("fname").value; document.getElementById("fname").value=x.toUpperCase(); }
2
by: Bob Nelson | last post by:
Concerning program startup in a hosted environment, both C90 and C99 require that the implementation provide main's ``argv'' strings in lowercase if the host environment is not capable of supply...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.