X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=format.php;h=a0e2f85f02d3a8438c5b66eb8d5fa4542454deee;hb=0dda9bc7c95f95dabdde7921790879a9d81d3700;hp=1ee11318b429e2a8b8b04d0bcd5a4dcd68988f6a;hpb=22d5fb7ab7d4ee86bd59e194387dca268bd577a1;p=wfpl.git diff --git a/format.php b/format.php index 1ee1131..a0e2f85 100644 --- a/format.php +++ b/format.php @@ -26,6 +26,18 @@ function format_int($str) { return ereg_replace('^0*([1-9])', '\1', $str); } +function format_filename($str) { + $str = strtolower($str); + $str = ereg_replace('[^a-z0-9_.-]', '_', $str); + return ereg_replace('^[0-9.-]*', '', $str); +} + +function format_varname($str) { + $str = strtolower($str); + $str = ereg_replace('[^a-z0-9_]', '_', $str); + return ereg_replace('^[0-9]*', '', $str); +} + function format_oneline($str) { $str = str_replace("\r", '', $str); return str_replace("\n", '', $str); @@ -117,24 +129,4 @@ function format_phone($str) { return $output; } - -#function ftest($val) { -# printf("$val: '%s'
\n", format_phone($val, true)); -#} -# -#echo "FORMAT TESTS

"; -#ftest("$3"); -#ftest("3.99"); -#ftest("3.5"); -#ftest("891234"); -#ftest("8221234"); -#ftest("82212334"); -#ftest("122313234"); -#ftest("1158221234"); -#ftest("1558221234"); -#ftest("12235513234"); -#ftest("122355123334"); -#ftest("1585552212334"); -#ftest("15855522123334"); - ?>