Click here to Skip to main content
15,915,600 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CTreeCtrl(finding out which item was right-clicked) Pin
Tomasz Sowinski4-Sep-02 6:05
Tomasz Sowinski4-Sep-02 6:05 
Generalrun Pin
Zizilamoroso4-Sep-02 1:05
Zizilamoroso4-Sep-02 1:05 
GeneralRe: run Pin
Tomasz Sowinski4-Sep-02 1:15
Tomasz Sowinski4-Sep-02 1:15 
Generalstd::string question Pin
Anonymous4-Sep-02 0:50
Anonymous4-Sep-02 0:50 
GeneralRe: std::string question Pin
Joaquín M López Muñoz4-Sep-02 0:58
Joaquín M López Muñoz4-Sep-02 0:58 
GeneralRe: std::string question Pin
Tomasz Sowinski4-Sep-02 1:02
Tomasz Sowinski4-Sep-02 1:02 
GeneralRe: std::string question Pin
Alexandru Savescu4-Sep-02 2:38
Alexandru Savescu4-Sep-02 2:38 
GeneralRe: std::string question Pin
Joaquín M López Muñoz4-Sep-02 2:49
Joaquín M López Muñoz4-Sep-02 2:49 
(with tremulous voice) Don't lead the guy apart from the one and true std::string! Now seriously, these functions, though not directly available, can be easily written:
/* String trimming templates.
 * Written by Markus B. Krüger (markusk@pvv.org)
 * Found at USENET:
 *   Subject: Re: trim in standard lib? 
 *   Newsgroups: comp.lang.c++.moderated
 *   Date: 2001-07-13 19:21:08 PST
 *   URL (Google): http://groups.google.com/groups?hl=en&selm=du38zhtjjze.fsf%40proto.pvv.ntnu.no
 *
 * NB: There's a typo on the original message. On trim_right(String& str, Ch ws), replace
 *
 *   if ((last_nonblank = str.find_last_not_of(' ')) != String::npos)
 *
 * with
 *   if ((last_nonblank = str.find_last_not_of(ws)) != String::npos)
 */
 
#ifndef TRIMTEMPLATES_H
#define TRIMTEMPLATES_H
 
#define VERSION_TRIMTEMPLATES 0x00010000
 
template<class String,class Ch>
inline String& trim_left(String& str,Ch ws)
{
  typename String::size_type first_nonblank;
  if ((first_nonblank=str.find_first_not_of(ws))!=String::npos)
    return str.erase(0, first_nonblank);
  else
    return str;
}  
 
template<class String>
inline String& trim_left(String& str)
{
  return trim_left(str, ' ');
}
 
template<class String,class Ch>
inline String& trim_right(String& str,Ch ws)
{
  typename String::size_type last_nonblank;
  if((last_nonblank=str.find_last_not_of(ws))!= String::npos)
    return str.erase(last_nonblank+1);
  else
    return str;
}  
 
template<class String>
inline String& trim_right(String& str)
{
  return trim_right(str, ' ');
}
 
template<class String,class Ch>
inline String& trim(String& str,Ch ws)
{
  return trim_left(trim_right(str, ws),ws);
}
 
template<class String>
inline String& trim(String& str)
{ 
  return trim_left(trim_right(str));
}
 
#elif VERSION_TRIMTEMPLATES!=0x00010000
#error You have included two LISTPORTS.H with different version numbers
#endif


Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
GeneralRe: std::string question Pin
Alexandru Savescu4-Sep-02 3:11
Alexandru Savescu4-Sep-02 3:11 
GeneralRe: std::string question Pin
Bill Wilson4-Sep-02 11:18
Bill Wilson4-Sep-02 11:18 
GeneralRe: std::string question Pin
Alexandru Savescu4-Sep-02 20:40
Alexandru Savescu4-Sep-02 20:40 
GeneralRe: std::string question Pin
Bill Wilson5-Sep-02 6:17
Bill Wilson5-Sep-02 6:17 
Generaltwo modal dialogs Pin
Luis Reina4-Sep-02 0:27
Luis Reina4-Sep-02 0:27 
GeneralRe: two modal dialogs Pin
Tomasz Sowinski4-Sep-02 0:36
Tomasz Sowinski4-Sep-02 0:36 
GeneralRe: two modal dialogs Pin
Joaquín M López Muñoz4-Sep-02 0:36
Joaquín M López Muñoz4-Sep-02 0:36 
GeneralRe: two modal dialogs Pin
Tomasz Sowinski4-Sep-02 0:41
Tomasz Sowinski4-Sep-02 0:41 
GeneralRe: two modal dialogs Pin
Luis Reina4-Sep-02 0:38
Luis Reina4-Sep-02 0:38 
GeneralRe: two modal dialogs Pin
Joaquín M López Muñoz4-Sep-02 0:35
Joaquín M López Muñoz4-Sep-02 0:35 
GeneralRe: two modal dialogs Pin
Luis Reina4-Sep-02 0:41
Luis Reina4-Sep-02 0:41 
GeneralRe: two modal dialogs Pin
Tomasz Sowinski4-Sep-02 0:40
Tomasz Sowinski4-Sep-02 0:40 
GeneralRe: two modal dialogs Pin
Joaquín M López Muñoz4-Sep-02 0:40
Joaquín M López Muñoz4-Sep-02 0:40 
GeneralPrinting HTML/MIME image in Outlook Pin
Hel4-Sep-02 0:23
Hel4-Sep-02 0:23 
QuestionHow do check if i am online Pin
Anonymous4-Sep-02 0:04
Anonymous4-Sep-02 0:04 
AnswerRe: How do check if i am online Pin
Jawache4-Sep-02 0:57
Jawache4-Sep-02 0:57 
GeneralRe: How do check if i am online Pin
Anonymous4-Sep-02 1:04
Anonymous4-Sep-02 1:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.