2 /**************************************************************************
3 ** (c) Copyright 2003, Andromeda Technology & Automation
4 ** This is free software; you can redistribute it and/or modify it under the
5 ** terms of the GNU General Public License, see the file COPYING.
6 ***************************************************************************
7 ** MODULE INFORMATION *
8 ***********************
9 ** FILE NAME : string_utils.cpp
10 ** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring
11 ** VERSION NUMBER : $Revision: 1.2 $
13 ** DESCRIPTION : Utility functions for Strings
18 ***************************************************************************
19 ** ADMINISTRATIVE INFORMATION *
20 ********************************
21 ** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
22 ** CREATION DATE : Jul 31, 2003
23 ** LAST UPDATE : Jul 31, 2003
25 **************************************************************************/
27 /*****************************
28 $Log: string_utils.cpp,v $
29 Revision 1.2 2003-10-27 11:26:43 arjen
30 Backslashes are correctly escaped with another backslash
32 Revision 1.1 2003/08/05 08:15:01 arjen
33 Debug output to the log stream instead of cerr.
34 Fixed namespace problems in XPath searches of the DOM.
35 Moved string utility functions to a separate file.
37 *****************************/
39 static const char *RCSID = "$Id: string_utils.cpp,v 1.2 2003-10-27 11:26:43 arjen Exp $";
41 #include <AXE/String.h>
43 /*=========================================================================
45 ** SYNOPSIS : String SQL_Escape(String)
49 ** DESCRIPTION : Insert backslashes before single quotes.
56 **=========================================================================
59 String SQL_Escape(String s)
63 for (i = 0; i < ~s; i++)
65 if (s[i] == '\'' || s[i] == '\\')
75 /*=========================================================================
76 ** NAME : XML_Entities
77 ** SYNOPSIS : String XML_Entities(String)
81 ** DESCRIPTION : Replace special characters for XML with their entity codes:
91 **=========================================================================
94 String XML_Entities(String s)
98 for (i = 0; i < ~s; i++)