Where to write public, common, utility functions in Drupal?
As many API modules do, you can place your global helper functions within a dedicated module. (I'll be using MYHELPERMODULE in the following example.)

You then should follow the naming conventions:

function MYHELPERMODULE_startswith($needle, $haystack) {
  // do your magic
}


You can call this function from within all other modules, as long as your helper module is active. To assure it's active, add your helper module as dependency to the .info file of the module that is using the helper function:

dependencies[] = MYHELPERMODULE