WordPress at a glance
function is not described

wc_get_string_before_colon() WC 3.2.0

Get part of a string before :.

Used for example in shipping methods ids where they take the format method_id:instance_id

No Hooks.

Return

String. Nothing.

Usage

wc_get_string_before_colon( $string );
$string(string) (required)
String to extract.

Changelog

Since 3.2.0 Introduced.

Code of wc_get_string_before_colon() WC 5.3.0

<?php
function wc_get_string_before_colon( $string ) {
	return trim( current( explode( ':', (string) $string ) ) );
}