Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Mehrdimensionales Array Javascript

Empfohlene Antworten

Veröffentlicht

Hi, ich möchte ein Mehrdimensionales Array lexikalisch sortieren

mehrdimensional sortieren geht ja recht einfach mit


index = 1;

arr.sort(function(a,{

  return a[index] - b[index]; //oder wie man halt sortieren will

});

[/code]

lexikalisch mit arr.sort() sortieren auch kein problem,

nur beides zusammen bekomm ich nicht hin :(

meine erste idee war, den string vorher in ascii-nummerierung umzuwandeln, aber da tanzen die umlaute aus der (sortier)-reihe

hat da jemand ne idee?

hi, thx bin damit schon ein bisschen weiter gekommen, aber ganz hab ich leider noch nicht

bin bisher hier:


 function desc(arr,spalte) {

  arr.sort(function(a,{

    return a[spalte] < b[spalte] ? 1 : (a[spalte] > b[spalte] ? (-1) : 0);

  });

}

[/code]

funktioniert auch, aber nur solange bis umlaute drinn sind, die sollen "aäbc..noöp..z" sortiert werden, nur bei dem > und < wird die nr aus der ascii tabelle benutzt daher sieht die sortierung so "abc...xyzäöü" aus :(

du willst also das Ä nach A kommt, also nicht in A einsortiert

AA .. AD AE/Ä AF ...

sondern

AA .. AZ Ä

?

beim einsortieren hätt ich gesagt, du kannst ja für den vergleich alle äöü durch ae/oe/ue ersetzen.

bzw such dir hier was aus: Alphabetische Sortierung ? Wikipedia ^^

die DIN Varianten wären meiner meinung nach leichter umzusetzen als die östereichische ..

hi, thx, habe selbst eine lösung gefunden, wandle den text in entsprechende ascii nummern um und nehm bei umlauten z.b. ascii von a + 0.5 für ä

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.