本文整理汇总了C++中String::DeleteLeft方法的典型用法代码示例。如果您正苦于以下问题:C++ String::DeleteLeft方法的具体用法?C++ String::DeleteLeft怎么用?C++ String::DeleteLeft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String::DeleteLeft方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
String PixInsightX11Installer::Unquoted( const String& s )
{
String r = s;
if ( s.BeginsWith( '\"' ) )
if ( s.EndsWith( '\"' ) )
{
r.DeleteRight( r.UpperBound() );
r.DeleteLeft( 1 );
}
if ( s.BeginsWith( '\'' ) )
if ( s.EndsWith( '\'' ) )
{
r.DeleteRight( r.UpperBound() );
r.DeleteLeft( 1 );
}
return r;
}
示例2: Error
void PixInsightX11Installer::CopyFiles( const String& targetDir, const String& sourceDir )
{
if ( !targetDir.BeginsWith( '/' ) )
throw Error( "CopyFiles(): Relative target directory." );
if ( !sourceDir.BeginsWith( '/' ) )
throw Error( "CopyFiles(): Relative source directory." );
if ( targetDir.EndsWith( '/' ) || sourceDir.EndsWith( '/' ) )
throw Error( "CopyFiles(): Incorrectly terminated directories." );
if ( !File::DirectoryExists( targetDir ) )
throw Error( "CopyFiles(): Nonexistent target directory." );
if ( !File::DirectoryExists( sourceDir ) )
throw Error( "CopyFiles(): Nonexistent source directory." );
StringList sourceItems = SearchDirectory( sourceDir );
size_type sourceDirLen = sourceDir.Length();
for ( StringList::const_iterator i = sourceItems.Begin(); i != sourceItems.End(); ++i )
{
String relSourcePath = *i;
relSourcePath.DeleteLeft( sourceDirLen );
String targetPath = targetDir + relSourcePath;
if ( targetPath.EndsWith( '/' ) )
{
/*
* Create a subdirectory
*/
targetPath.Delete( targetPath.UpperBound() );
if ( !File::DirectoryExists( targetPath ) )
{
File::CreateDirectory( targetPath );
String sourcePath = *i;
sourcePath.Delete( sourcePath.UpperBound() );
File::CopyTimesAndPermissions( targetPath, sourcePath );
}
}
else
{
/*
* Copy a file
*/
/*
* ### N.B. We don't have to create subdirectories here becase they
* have been reported by SearchDirectory(), and we are creating them
* before copying files. SearchDirectory() promises that all
* subdirectories are reported before their contained files.
*/
/*
String targetSubdir = File::ExtractDirectory( targetPath );
if ( targetSubdir.EndsWith( '/' ) )
targetSubdir.Delete( targetSubdir.UpperBound() );
if ( !File::DirectoryExists( targetSubdir ) )
File::CreateDirectory( targetSubdir );
*/
File::CopyFile( targetPath, *i );
}
}
}