String utility functions and the std::string class. More...
#include "linden_common.h"
#include "llstring.h"
#include "llerror.h"
Namespaces | |
namespace | LLStringFn |
Functions | |
bool | _read_file_into_string (std::string &str, const std::string &filename) |
read the contents of a file into a string. | |
U8 | hex_as_nybble (char hex) |
This translates a nybble stored as a hex value from 0-f back to a nybble in the low order bits of the return byte. | |
std::string | ll_safe_string (const char *in) |
Return a string constructed from in without crashing if the pointer is NULL. | |
std::string | rawstr_to_utf8 (const std::string &raw) |
void | LLStringFn::replace_ascii_controlchars (std::basic_string< char > &string, char replacement) |
Replace all control characters (c < 0x20) with replacement in string. | |
void | LLStringFn::replace_nonprintable_and_pipe_in_ascii (std::basic_string< char > &str, char replacement) |
Replace all non-printable characters and pipe characters with replacement in a string. NOTE - this will zap non-ascii. | |
void | LLStringFn::replace_nonprintable_in_ascii (std::basic_string< char > &string, char replacement) |
Replace all non-printable characters with replacement in string. NOTE - this will zap non-ascii. | |
std::string | LLStringFn::strip_invalid_xml (const std::string &input) |
Remove all characters that are not allowed in XML 1.0. Returns a copy of the string with those characters removed. Works with US ASCII and UTF-8 encoded strings. JC. | |
std::string | utf8str_substChar (const std::string &utf8str, const llwchar target_char, const llwchar replace_char) |
Replace all occurences of target_char with replace_char. | |
std::string | utf8str_truncate (const std::string &utf8str, const S32 max_len) |
Properly truncate a utf8 string to a maximum byte count. |
String utility functions and the std::string class.
Copyright (c) 2001-2009, Linden Research, Inc.
Second Life Viewer Source Code The source code in this file ("Source Code") is provided by Linden Lab to you under the terms of the GNU General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other License"), formally executed by you and Linden Lab. Terms of the GPL can be found in doc/GPL-license.txt in this distribution, or online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
There are special exceptions to the terms and conditions of the GPL as it is applied to this Source Code. View the full text of the exception in the file doc/FLOSS-exception.txt in this software distribution, or online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
By copying, modifying or distributing this software, you acknowledge that you have read and understood your obligations described above, and agree to abide by those obligations.
ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, COMPLETENESS OR PERFORMANCE. $/LicenseInfo$
bool _read_file_into_string | ( | std::string & | str, | |
const std::string & | filename | |||
) |
read the contents of a file into a string.
Since this function has no concept of character encoding, most anything you do with this method ill-advised. Please avoid.
str | [out] The string which will have. | |
filename | The full name of the file to read. |
std::string rawstr_to_utf8 | ( | const std::string & | raw | ) |
Unicode support
std::string utf8str_substChar | ( | const std::string & | utf8str, | |
const llwchar | target_char, | |||
const llwchar | replace_char | |||
) |
Replace all occurences of target_char with replace_char.
utf8str | A utf8 string to process. | |
target_char | The wchar to be replaced | |
replace_char | The wchar which is written on replace |
std::string utf8str_truncate | ( | const std::string & | utf8str, | |
const S32 | max_len | |||
) |
Properly truncate a utf8 string to a maximum byte count.
The returned string may be less than max_len if the truncation happens in the middle of a glyph. If max_len is longer than the string passed in, the return value == utf8str.
utf8str | A valid utf8 string to truncate. | |
max_len | The maximum number of bytes in the return value. |