]> wagnertech.de Git - kivitendo-erp.git/blobdiff - SL/Form.pm
Eine Funktion zur Formatierung von Strings, die Vorkommen von "#n" durch das n-te...
[kivitendo-erp.git] / SL / Form.pm
index c4c7951f91eb6406ab530f5b8520a4e08be9f229..b32fbd2b041a70e26575d2d6b4c05831d00dd843 100644 (file)
@@ -758,6 +758,22 @@ sub format_amount {
   return $amount;
 }
 #
+
+sub format_string {
+  $main::lxdebug->enter_sub(2);
+
+  my $self  = shift;
+  my $input = shift;
+
+  $input =~ s/(^|[^\#]) \#  (\d+)  /$1$_[$2 - 1]/gx;
+  $input =~ s/(^|[^\#]) \#\{(\d+)\}/$1$_[$2 - 1]/gx;
+  $input =~ s/\#\#/\#/g;
+
+  $main::lxdebug->leave_sub(2);
+
+  return $input;
+}
+
 sub parse_amount {
   $main::lxdebug->enter_sub(2);