Search the Community
Showing results for tags 'length'.
-
How to write GROUP_CONCAT_MAX_LEN Increasing as per requriement in perticuar select query in php.....
- 5 replies
-
- increasing
- max
-
(and 3 more)
Tagged with:
-
Hello guys, i need some experienced info here.. i need to sort selected data, thats why i used case like: SELECT * FROM Customers ORDER BY CASEWHEN CustomerName LIKE '%a%' THEN 1WHEN CustomerName LIKE '%b%' THEN 2ELSE 3END Everythings fine here, but I need to sort each sector (1, 2 and 3) seperately by CustomerName`s lenght. How to do that? any ideas ?
-
Hello, I am trying to comprehend how to compare the length between Strings.i have the following, to compare the length of 10 countries inserted by the user. It also orders them from lowest to highest: public void load() { teclado=new Scanner(System.in); paises=new String[10]; for(int f=0;f<paises.length;f++) { System.out.print("Ingrese el nombre del pais:"); paises[f]=teclado.next(); } } public void ordenar() { for(int k=0;k<9;k++) { for(int f=0;f<9-k;f++) { if (paises[f].compareTo(paises[f+1])>0) { String aux; aux=paises[f]; paises[f]=paises[f+1]; paises[f+1]=aux; } } } } When I use the same method with numbers it works. For instance: public void ordenar() { for(int k=0;k<9;k++){ for(int f=0;f<9-k;f++) { if (vec[f+1]<vec[f]) { int aux; aux=vec[f]; vec[f]=vec[f+1]; vec[f+1]=aux; } } } } So I deduce maybe : if (paises[f].compareTo(paises[f+1])>0) is not correct, because it's the only difference comparing it to the method on numbers.Is there any other way to compare the length between Strings? thank you in advance. p.s I took it from a tutorial which has been working fine till now. I have even checked the "compareTo" on other sites and it seems to be appropriate but I don't know why it's not working here. I would appreciate any help.