Thread Richtig INTen (14 answers)
Opened by bianca at 2009-12-24 09:27

bianca
 2012-01-17 08:32
#155496 #155496
User since
2009-09-13
6977 Artikel
BenutzerIn

user image
Hab es im Moment so implementiert. Deckt auch den .57*100 Fall ab.
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
sub integer {
    my $wert = shift ( @_ ) || 0;
    if ($wert =~ /e\-\d+$/) { return 0; }               
    if ($wert =~ /\./) {
        my $neu = '';
        for (my $st = 0; $st < length($wert); $st ++) {
            if (substr($wert,$st,1) eq '.') { last; }
            else { $neu .= substr($wert,$st,1); }
        }
        $neu = 0 if $neu eq '';
        $wert = $neu;
        $wert = 0 if $wert == -0;
    }
    return $wert;
}
10 print "Hallo"
20 goto 10

View full thread Richtig INTen