function _calendar_systems_fix_whitespace in Calendar Systems 7.2
Same name and namespace in other branches
- 8 calendar_systems.helpers.inc \_calendar_systems_fix_whitespace()
- 6.3 calendar_systems.module \_calendar_systems_fix_whitespace()
- 6 calendar_systems.module \_calendar_systems_fix_whitespace()
- 7.3 calendar_systems.module \_calendar_systems_fix_whitespace()
- 7 calendar_systems.helpers.inc \_calendar_systems_fix_whitespace()
Helper function
Parameters
$format:
$granularity:
Return value
string
1 call to _calendar_systems_fix_whitespace()
- _calendar_systems_get_format in ./
calendar_systems.helpers.inc - Helper function
File
- ./
calendar_systems.helpers.inc, line 188
Code
function _calendar_systems_fix_whitespace($format, $granularity) {
$new_format = '';
$list = _calendar_systems_get_date_format();
//remove whitespaces from end
$i = strlen($format) - 1;
for (; $i >= 0; $i--) {
$c = $format[$i];
if (isset($list[$c])) {
break;
}
}
$format = substr($format, 0, $i + 1);
//remove whitespaces from begining
$i = 0;
for (; $i < strlen($format); $i++) {
$c = $format[$i];
if (isset($list[$c])) {
break;
}
}
$new_format = substr($format, $i, strlen($format) - $i);
return $new_format;
}