Project

General

Profile

« Previous | Next » 

Revision 7955

web/vegpath/util.php: Added ensure_prefix(), ensure_suffix()

View differences:

web/vegpath/util.php
20 20
		substr($str, 0, strlen($str) - strlen($suffix)) : $str;
21 21
}
22 22

  
23
function ensure_prefix($prefix, $str)
24
{
25
	return starts_with($str, $prefix) ? $str : $prefix.$str;
26
}
27

  
28
function ensure_suffix($suffix, $str)
29
{
30
	return ends_with($str, $suffix) ? $str : $str.$suffix;
31
}
32

  
23 33
class Path
24 34
{
25 35
	public $head;

Also available in: Unified diff