WC_Gateway_Paypal_Request::limit_length()
Limit length of an arg.
Method of the class: WC_Gateway_Paypal_Request{}
No Hooks.
Return
String
.
Usage
// protected - for code of main (parent) or child class $result = $this->limit_length( $string, $limit );
- $string(string) (required)
- Argument to limit.
- $limit(int)
- Limit size in characters.
Default: 127
WC_Gateway_Paypal_Request::limit_length() WC Gateway Paypal Request::limit length code WC 8.6.1
protected function limit_length( $string, $limit = 127 ) { $str_limit = $limit - 3; if ( function_exists( 'mb_strimwidth' ) ) { if ( mb_strlen( $string ) > $limit ) { $string = mb_strimwidth( $string, 0, $str_limit ) . '...'; } } else { if ( strlen( $string ) > $limit ) { $string = substr( $string, 0, $str_limit ) . '...'; } } return $string; }