Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
wfpl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bf847ba
)
added format_varname() and format_filename()
author
Jason Woofenden
<jason183@herkamire.com>
Thu, 22 Feb 2007 06:51:44 +0000
(
01:51
-0500)
committer
Jason Woofenden
<jason183@herkamire.com>
Thu, 22 Feb 2007 06:51:44 +0000
(
01:51
-0500)
format.php
patch
|
blob
|
history
diff --git
a/format.php
b/format.php
index
1ee1131
..
a0e2f85
100644
(file)
--- a/
format.php
+++ b/
format.php
@@
-26,6
+26,18
@@
function format_int($str) {
return ereg_replace('^0*([1-9])', '\1', $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);
function format_oneline($str) {
$str = str_replace("\r", '', $str);
return str_replace("\n", '', $str);
@@
-117,24
+129,4
@@
function format_phone($str) {
return $output;
}
return $output;
}
-
-#function ftest($val) {
-# printf("$val: '%s'<br />\n", format_phone($val, true));
-#}
-#
-#echo "FORMAT TESTS<br><br>";
-#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");
-
?>
?>