本文整理汇总了C++中StringRef::Length方法的典型用法代码示例。如果您正苦于以下问题:C++ StringRef::Length方法的具体用法?C++ StringRef::Length怎么用?C++ StringRef::Length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringRef
的用法示例。
在下文中一共展示了StringRef::Length方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadToken
StringRef SirenTextParser::ReadToken(StringRef& refProto)
{
refProto = refProto.TrimBegin();
if (refProto.IsEmpty())
{
return StringRef::Empty;
}
if (StdString::IsDigit(refProto[0]))
{
Log::FormatError("Token cannot begin with number:{}", refProto[0]);
return StringRef::Empty;
}
size_t tokenLength = 0;
size_t length = refProto.Length();
for (size_t i = 0; i < length - 1; ++i)
{
int c = refProto[i];
if (StdString::IsToken(c))
{
++tokenLength;
}
else
{
break;
}
}
StringRef token = refProto.SubString(0, tokenLength);
refProto = refProto.SubString(tokenLength);
return token;
}
示例2: WriteAllText
bool File::WriteAllText(StringRef filePath, StringRef str)
{
FileStream writer(filePath, FileOpenMode::DestoryWriteOrCreate, FileDataType::Text);
if (writer.IsOpen())
{
return writer.WriteString(str,false) == str.Length();
}
return false;
}
示例3: StringTo
bool StringParser::StringTo(const StringRef& inString, int base /*= 10*/)
{
if (inString.Length() != 4)
{
return false;
}
return inString.Compare("TRUE", true) == 0;
}
示例4: IsPort
bool IPAddress::IsPort(StringRef inValue)
{
//Port format:<d*>
RETURN_FALSE_IF_EMPTY(inValue);
size_t length = inValue.Length();
for (size_t i = 0; i < length; i++)
{
if (!isdigit(inValue[i]))
{
return false;
}
}
return true;
}
示例5: Write
void NetworkBuffer::Write(const StringRef& val)
{
return Write((byte*)val.c_str(), val.Length());
}
示例6: ToW
WHeapString StringParser::ToW(const StringRef& str)
{
WHeapString tempBuffer;
ConvertToBuffer(str.c_str(), str.Length(), tempBuffer);
return tempBuffer;
}
示例7: ConvertToBuffer
intp StringParser::ConvertToBuffer(const StringRef& inBuffer, WHeapString& outBuffer)
{
return ConvertToBuffer(inBuffer.Buffer(), inBuffer.Length(), outBuffer);
}
示例8:
//------------------------------------------------------------
VIREO_EXPORT Int32 Data_GetStringLength(StringRef stringObject)
{
VIREO_ASSERT(String::ValidateHandle(stringObject));
return stringObject->Length();
}