Thread Zeilenumbruch (7 answers)
Opened by tadeus at 2010-09-06 22:38

tadeus
 2010-09-06 22:47
#141228 #141228
User since
2009-10-09
19 Artikel
BenutzerIn
[default_avatar]
Danke, das mit den Anführungszeichen wusst ich nicht, das es differenziert wird.

Hier meine benutzte Funktion:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
sub explode($$;$) 
{
 my ($separator,$string,$limit) = @_;
 my @splitted;

 my $x       = 1;
 my $offset  = 0;
 my $sep_len = length($separator);

 while((my $pos = index($string,$separator,$offset)) >= 0 && (!$limit || $x < $limit))
 {
  my $part = substr($string,$offset,$pos-$offset);
  push(@splitted,$part);

  $offset = $pos+$sep_len;

  $x++;
 }

 push(@splitted,substr($string,$offset,length($string)-$offset));

 return @splitted;
}



Edit:
ok hat sich erledigt, hier muss ich auch die " benutzen
Danke
Last edited: 2010-09-06 22:51:00 +0200 (CEST)

View full thread Zeilenumbruch