AtomicSoft.com Add power to your website!
Home Products Services Support Free
EasyData/SQL
easy-to-use web interface for SQL databases with countless features
AtomicDesk
help desk, FAQ, knowledge base, live support chat - all in one product
Custom programming
Installation
Documentation
HelpDesk
Libraries
Join our newsletter for information on software updates and new releases. You may unsubscribe at any time.



Click here to download plain text source code.

# subroutine name: cprintf
# Input: string with %1,%2,%3... meta-strings, meta-string replacements
# Replaces these meta-strings with next parameters,
# passed to routine, and returns processed string
# Usage example: cprintf("I %2 free scripts, do %1?", "you", "like");
#        Result: "I like free scripts, do you?"
sub    cprintf {
    my ($template, @vals)=@_;
    $template=~s/\%(\d+)/($1>=1 && $1<=scalar @vals)?$vals[$1-1]:"%$1"/ges;
    return $template;
}
 
Copyright © 1999-2007 Atomicsoft Ltd. All Rights Reserved.