Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Abstract_Notification_View::sentence_case( string $string )

Convert a string to sentence case


Description Description

Useful for handling lowercased merged data like "you" which may appear at the beginning or middle of a sentence.


Top ↑

Parameters Parameters

$string

(string) (Required) A string.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/abstracts/llms.abstract.notification.view.php

	private function sentence_case( $string ) {

		$sentences  = preg_split( '/(\.|\?|\!)(\s|$)+/', $string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
		$new_string = '';
		foreach ( $sentences as $sentence ) {
			$new_string .= strlen( $sentence ) === 1 ? $sentence . ' ' : ucfirst( trim( $sentence ) );
		}

		return trim( $new_string );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.8.0
3.24.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.