fix and make publicly available the upper case and lower case conversion functions

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7834 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2005-11-09 22:59:01 +00:00
commit 8c8a47c03d
2 changed files with 13 additions and 6 deletions

View file

@ -94,14 +94,15 @@ String *Swig_string_escape(String *s) {
/* -----------------------------------------------------------------------------
* Swig_string_upper()
*
* Takes a string object and convets it to all caps.
* Takes a string object and returns a copy that is uppercase
* ----------------------------------------------------------------------------- */
String *Swig_string_upper(String *s) {
String *ns;
int c;
ns = NewString("");
Seek(s,0,SEEK_SET);
while ((c = Getc(s)) != EOF) {
Putc(toupper(c),ns);
}
@ -111,14 +112,15 @@ String *Swig_string_upper(String *s) {
/* -----------------------------------------------------------------------------
* Swig_string_lower()
*
* Takes a string object and convets it to all lower.
* Takes a string object and returns a copy that is lowercase
* ----------------------------------------------------------------------------- */
String *Swig_string_lower(String *s) {
String *ns;
int c;
ns = NewString("");
Seek(s,0,SEEK_SET);
while ((c = Getc(s)) != EOF) {
Putc(tolower(c),ns);
}
@ -129,7 +131,8 @@ String *Swig_string_lower(String *s) {
/* -----------------------------------------------------------------------------
* Swig_string_title()
*
* Takes a string object and convets it to all lower.
* Takes a string object and returns a copy that is lowercase with first letter
* capitalized
* ----------------------------------------------------------------------------- */
String *Swig_string_title(String *s) {
@ -137,7 +140,8 @@ String *Swig_string_title(String *s) {
int first = 1;
int c;
ns = NewString("");
Seek(s,0,SEEK_SET);
while ((c = Getc(s)) != EOF) {
Putc(first ? toupper(c) : tolower(c),ns);
first = 0;

View file

@ -437,6 +437,9 @@ extern String *Swig_scopename_last(String *s);
extern String *Swig_scopename_first(String *s);
extern String *Swig_scopename_suffix(String *s);
extern int Swig_scopename_check(String *s);
extern String *Swig_string_lower(String *s);
extern String *Swig_string_upper(String *s);
extern String *Swig_string_title(String *s);
extern void Swig_init();
extern void Swig_warn(const char *filename, int line, const char *msg);