before_last_bar( string $string )
Remove last item on a pipe-delimited string.
描述
Meant for removing the last item in a string, such as ‘Role name|User role’. The original string will be returned if no pipe ‘|’ characters are found in the string.
参数
- $string
-
(string)
(Required)
A pipe-delimited string.
返回值
(string) Either $string or everything before the last pipe.
源代码
File: wp-includes/l10n.php
function before_last_bar( $string ) {
$last_bar = strrpos( $string, '|' );
if ( false === $last_bar ) {
return $string;
} else {
return substr( $string, 0, $last_bar );
}
}
更新日志
Version | 描述 |
---|---|
2.8.0 | Introduced. |
相关函数
Used By
-
wp-includes/l10n.php:
translate_user_role() -
wp-includes/deprecated.php:
_c() -
wp-includes/deprecated.php:
translate_with_context() -
wp-includes/deprecated.php:
_nc()
User Contributed Notes
你可能对这些文章感兴趣:
- wordpress函数esc_html_x()用法示例
- wordpress函数esc_html()用法示例
- wordpress函数esc_html_e()用法示例
- wordpress函数esc_attr_x()用法示例
- wordpress函数esc_attr__()用法示例
- wordpress函数esc_attr()用法示例
- wordpress函数esc_attr_e()用法示例
- wordpress函数ent2ncr()用法示例
- wordpress函数enqueue_embed_scripts()用法示例
- wordpress函数enqueue_comment_hotkeys_js()用法示例
- wordpress函数edit_user()用法示例
- wordpress函数email_exists()用法示例
- wordpress函数endElement()用法示例
- wordpress函数edit_term_link()用法示例
如有疑问,请前往问答中心反馈!
反馈