示例#1
0
char ImmutableString::charAt(int index)
{
	if ((index < 0) || (index >= m_pProxy->count)) {
	    throw StringIndexOutOfBoundsException(index);
	}
	return m_pProxy->value[index + m_pProxy->offset];
}
示例#2
0
ImmutableString::ImmutableString(char *str)
{
	if(str==NULL || strlen(str)<1)
		throw StringIndexOutOfBoundsException(-1);

	m_pProxy = new StringProxy(str);
	AddRef();
}
示例#3
0
utf16string utf16string::substring(int beginIndex, int endIndex) const
{
	//UTF16
    try {
        std::u16string sub = m_data->u16str().substr(beginIndex, endIndex - beginIndex);
        utf16string answer;
        answer.setData(new StringData(sub));
        return answer;
    }
    catch (std::out_of_range &e) {
        throw StringIndexOutOfBoundsException(e.what());
    }
}
示例#4
0
wchar SString::operator[](int i) const{
  if (i >= len) throw StringIndexOutOfBoundsException(SString(i));
  return wstr[i];
}