Subversion Repositories spk

Rev

Rev 291 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 291 Rev 298
Line 725... Line 725...
725

725

726
SString SString::mid(long long start, long long end) const
726
SString SString::mid(long long start, long long end) const
727
{
727
{
728
	if (end <= 0)
728
	if (end <= 0)
729
		end = this->length() + end;
729
		end = this->length() + end;
730
	return this->substr(start, static_cast<size_t>(end - start));
730
	return this->substr(static_cast<size_t>(start), static_cast<size_t>(end - start));
731
}
731
}
732
SString SString::left(long long num) const
732
SString SString::left(long long num) const
733
{
733
{
734
	const long long len = this->lengthLL();
734
	const long long len = this->lengthLL();
735
	if ( num < 0 )
735
	if ( num < 0 )
736
		num = len + num;
736
		num = len + num;
737
	if ( num > len )
737
	if ( num > len )
738
		num = len;
738
		num = len;
739

739

740
	return this->substr(0, num);
740
	return this->substr(0, static_cast<size_t>(num));
741
}
741
}
742

742

743
SString SString::right(long long num) const
743
SString SString::right(long long num) const
744
{
744
{
745
	const long long len = this->lengthLL();
745
	const long long len = this->lengthLL();
746

746

747
	if ( num > 0 ) num -= len;
747
	if ( num > 0 ) num -= len;
748
	if ( num < -len ) num = -len;
748
	if ( num < -len ) num = -len;
749

749

750
	return this->substr(-num);
750
	return this->substr(static_cast<size_t>(-num));
751
}
751
}
752

752

753
const SString &SString::readToEndOfLine(FILE *id, int *line, bool upper)
753
const SString &SString::readToEndOfLine(FILE *id, int *line, bool upper)
754
{
754
{
755
	(*this) = "";
755
	(*this) = "";