main/sfx2/source/doc/DocumentMetadataAccess.cxx
/** split a uri hierarchy into first segment and rest */
split a uri hierarchy into first segment and rest
split a uri hierarchy into first segment and rest
static bool
splitPath(::rtl::OUString const & i_rPath,
    ::rtl::OUString & o_rDir, ::rtl::OUString& o_rRest)
{
    const sal_Int32 idx(i_rPath.indexOf(static_cast<sal_Unicode>('/')));
    if (idx < 0 || idx >= i_rPath.getLength()) {
        o_rDir = ::rtl::OUString();
        o_rRest = i_rPath;
        return true;
    } else if (idx == 0 || idx == i_rPath.getLength() - 1) {
        return false;
    } else {
        o_rDir  = (i_rPath.copy(0, idx));
        o_rRest = (i_rPath.copy(idx+1));
        return true;
    }
}
static bool splitPath ( :: rtl :: OUString const & i_rPath , :: rtl :: OUString & o_rDir , :: rtl :: OUString & o_rRest ) { const sal_Int32 idx ( i_rPath . indexOf ( static_cast < sal_Unicode > ( ' ' ) ) ) ; if ( idx < 0 || idx >= i_rPath . getLength ( ) ) { o_rDir = :: rtl :: OUString ( ) ; o_rRest = i_rPath ; return true ; } else if ( idx == 0 || idx == i_rPath . getLength ( ) - 1 ) { return false ; } else { o_rDir = ( i_rPath . copy ( 0 , idx ) ) ; o_rRest = ( i_rPath . copy ( idx + 1 ) ) ; return true ; } }
split a uri hierarchy into first segment and rest
split a uri hierarchy into first segment and rest
// input must not start or end with '/'