Changeset 64 for cpp/gdk/sstringutils.cpp
- Timestamp:
- 01/28/11 23:29:40 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/gdk/sstringutils.cpp
r5 r64 1 // This file is a part of Framsticks GDK library.2 // Copyright (C) 2002-20 06Szymon Ulatowski. See LICENSE.txt for details.3 // Refer to http://www.frams .alife.pl/ for further information.1 // This file is a part of the Framsticks GDK library. 2 // Copyright (C) 2002-2011 Szymon Ulatowski. See LICENSE.txt for details. 3 // Refer to http://www.framsticks.com/ for further information. 4 4 5 5 #include "sstringutils.h" … … 233 233 } 234 234 235 SString trim(SString& s) 236 { 237 const unsigned char*b=(const unsigned char*)(const char*)s; 238 const unsigned char*e=b+s.len(); 239 while((b<e)&&(*b<=' ')) b++; 240 while((b<e)&&(e[-1]<=' ')) e--; 241 if ((e-b)==s.len()) return s; 242 SString newstring; 243 char* t=newstring.directWrite(); 244 memmove(t,b,e-b); 245 newstring.endWrite(e-b); 246 return newstring; 247 }
Note: See TracChangeset
for help on using the changeset viewer.