| version 1.1, 2002/04/20 23:03:15 |
version 1.2, 2002/04/21 23:23:43 |
|
|
| <?php |
<?php |
| |
|
| /* |
/* |
| * append_slash() |
* phpPlatonLib - Platon software development group PHP library |
| * |
* |
| * Appends slash at the end of string if string is not empty and slash |
* common/str/fnc.append_slash.php - append slash at the end of |
| * is not already present at the end of string. |
* string if it is not empty and slash is not already present at |
| * On success returns changed string, on failure returns false; |
* the end of string; return changed string on success, on |
| |
* failure returns false |
| |
* ____________________________________________________________ |
| |
* |
| |
* Developed by Ondrej Jombik <nepto@pobox.sk> |
| |
* Copyright (c) 2001-2002 Platon SDG, http://www.platon.sk/ |
| |
* All rights reserved. |
| |
* |
| |
* See README file for more information about this software. |
| |
* See COPYING file for license information. |
| |
* |
| |
* Download the latest version from |
| |
* http://www.platon.sk/projects/phpPlatonLib/ |
| */ |
*/ |
| |
|
| function append_slash($string, $char = '/') |
/* $Id$ */ |
| { |
|
| if (! is_string($string) || ! is_string($char)) |
if (! defined('phpPlatonLib_fnc_append_slash')) { |
| return false; |
define('phpPlatonLib_fnc_append_slash', 1); |
| |
|
| if (strlen($string) > 0) { |
function append_slash($string, $char = '/') |
| if ($string[strlen($string) - 1] != $char[0]) |
{ |
| $string .= $char[0]; |
if (! is_string($string) || ! is_string($char)) |
| |
return false; |
| |
|
| |
if (strlen($string) > 0) { |
| |
if ($string[strlen($string) - 1] != $char[0]) |
| |
$string .= $char[0]; |
| |
} |
| |
|
| |
return $string; |
| } |
} |
| |
|
| return $string; |
|
| } |
} |
| |
|
| ?> |
?> |