Hallo Udo,
Ich dachte an ein Split und dann irgendwie sortieren.
die Methode müsste so funktionieren:
print sort split /(?=[a-z])/, "h7a5u34t1g5i888";
Ob das wirklich von der Performance her das beste Verfahren ist, weiß ich aber nicht (immerhin benutzt das split einen regulären Ausdruck).
Danke!!!
Ich hatte gerade folgendes versucht, was funktioniert, aber wohl sicher nicht toll :-) ist!
$text = 'a5h7i888u34t1g5';
$count = 0;
print $text."\n";
while ($text)
{
$array[$count] = $text;
$array[$count] =~ s/^([a-z]\d*).*/$1/i;
$text =~ s/^($array[$count])(.*)/$2/i;
print $array[$count]."\n";
$count++;
}
$sorted = join('',sort @array);
print $sorted."\n";