Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
string_util.hh
Package: SwordOnline.rar [view]
Upload User: dzyhzl
Upload Date: 2019-04-29
Package Size: 56270k
Code Size: 1k
Category:
Game Server Simulator
Development Platform:
C/C++
- #ifndef __STRING_UTIL1__
- #define __STRING_UTIL1__
- #include <ctype.h>
- #include <string>
- using namespace std;
- extern void strip (string& s); // Strips blanks at left and right ends
- extern void escape_string (string& s); // C++ equivalent of mysql_escape_string
- inline void str_to_upr (string& s) { // Changes case of string to upper
- for (unsigned int cnt=0; cnt < s.length(); cnt++) {
- char c = s[cnt]; s[cnt]=toupper(c);
- }
- }
- inline void str_to_lwr (string& s) { // Changes case of string to lower
- for (unsigned int cnt=0; cnt < s.length(); cnt++) {
- char c = s[cnt]; s[cnt]=tolower(c);
- }
- }
- inline void strip_all_blanks (string& s) { // Removes all blanks
- for (unsigned int counter=0;counter < s.size();counter++)
- if (s[counter] == ' ') { s.erase(counter,1); counter--;}
- }
- inline void strip_all_non_num (string& s) { // Removes all non-numerics
- for (unsigned int counter=0;counter < s.size();counter++)
- if (!isdigit(s[counter])) { s.erase(counter,1); counter--;}
- }
- #endif