You are here

function oa_core_get_last_word in Open Atrium Core 7.2

Helper to return last word of a string

1 call to oa_core_get_last_word()
oa_core_sort_users_by_name in includes/oa_core.util.inc
Sort function to sort users by name.

File

includes/oa_core.util.inc, line 1212
Code for Utility functions for OpenAtrium spaces

Code

function oa_core_get_last_word($string) {

  // Strip any text in parens or brackets
  // Also strip any title ending in period, like PhD.
  // Also strip roman numerals I, II, IV, etc
  $string = preg_replace('/([\\(\\[].*[\\)\\]]|\\s[^\\s]+\\.$|\\s[IV]+)/', '', $string);
  $string = trim($string);
  return ($pos = strrpos($string, ' ')) ? substr($string, $pos + 1) : $string;
}