Software-OK
≡... News | ... Home | ... FAQ | Impressum | Contact | Listed at | Thank you |

  
HOME ► Faq ► FAQ - Windows-CPP-und-C ► ««« »»»

Trim string in cpp?


With your own trim string in cpp, simply shorten the strings individually!







////////////////////////////////////////////////// //////////////////////
//
// The Trim String OK function removes spaces and tabs!
//
//////////////////////////////////////////////// ////////////////////////

#include
#include
#include

TCHAR * TrimStringOK(TCHAR *txt)
{
TCHAR *buf=txt;
// Bereinige linke Seite bzw. Anfang
while(*buf!=0)
{
if(*buf==' '||*buf=='\t'){ }
else break;
buf++;
}
int len=lstrlen(buf);
TCHAR *last=buf+(len-1);
// Bereinige rechte Seite bzw. Anfang (reverse search)
while(last>buf)
{
if(*last==_T(' ')||*last=='\t'){ *last=_T('\0'); }
else break;
last--;
}
return buf;
}
///////////////////////////////////////////////// /////////////////////
//
// Test by TrimStringOK!
//
//////////////////////////////////////////////// //////////////////////

void main ()
{

TCHAR txt = "gggg";

printf (_T ("\"% s \ ""), txt);

TCHAR * trimmed = TrimStringOK (txt);

printf (_T ("\"% s \ ""), trimmed);

/ *
Output:
"gggg"
"gggg"
* /

}





FAQ 3: Updated on: 19 March 2021 10:07 Windows
Windows-CPP-und-C

How can I query whether a path is a folder or directory?


Querying whether a path is a folder or directory is quite simple in C ++  BOOL IsThePathFolderLPCTSTR pfad { ifpfadreturn FALSE; DWORD dwAttr = GetFileAttributespfad;
Windows-CPP-und-C

Was with error code -1073741701 (0xc000007b)!


The solution is very simple to fix the error code: "was ended with code -1073741701 0xc000007b error message" Mostly there are errors in the * .manifest
Windows-CPP-und-C

RGB Pixel to Negative!


Here is the solution to make an RGB pixel a negative RGB PIXEL BYTE R = 255-R;  BYTE G = 255-G;  BYTE B = 255-B;    Or with gray scaling:    BYTE gray_value
Windows-CPP-und-C

ListView_GetItemImage, ListView_GetISubtemImage!


The solution is very simple to find out in ListView Get Item Image and List View GetI Subtem Image ////////////////////////////////////////////////// //////////////////////
Windows-CPP-und-C

ShellExecuteEx function, search in LPCITEMIDLIST!


The solution is very easy to start with the ShellExecuteEx function, search for File in in  LPCITEMIDLIST BOOL SearchCmdLPCITEMIDLIST LPCITEMIDLIST item,
Windows-CPP-und-C

Listview set thumbnails size!


You can quickly set the size of the thumbnails in the list view, and there are no restrictions on the size   HIMAGELIST CreateNewImageListHWND m_hWnd,
Windows-CPP-und-C

Reserve virtual memory C++, Windows?


The solution is very simple if you want to reserve virtual memory with C++ under Windows  Contents: 1. The program command to reserve virtual memory

»»

  My question is not there in the FAQ
Asked questions on this answer:
Keywords: windows, trim, string, with, your, simply, shorten, strings, individually, Questions, Answers, Software




    

  + Freeware
  + Order on the PC
  + File management
  + Automation
  + Office Tools
  + PC testing tools
  + Decoration and fun
  + Desktop-Clocks

  + SoftwareOK Pages
  + Micro Staff
  + Freeware-1
  + Freeware-2
  + Freeware-3
  + FAQ
  + Downloads

  + Top
  + Desktop-OK
  + The Quad Explorer
  + Don't Sleep
  + Win-Scan-2-PDF
  + Quick-Text-Past
  + Print Folder Tree
  + Find Same Images
  + Experience-Index-OK
  + Font-View-OK


  + Freeware
  + CoronaKO
  + MatriX.CoronaKO
  + Find.Same.Images.OK
  + 3D.Benchmark.OK
  + PhotoResizerOK
  + Office.Files.Images
  + Film.Strip.Explorer
  + WinScan2PDF
  + DontSleep
  + PAD-s


Home | Thanks | Contact | Link me | FAQ | Windows 2021 | Windows 10 | English-AV | Impressum | Translate | PayPal | PAD-s

 © 2023 by Nenad Hrg softwareok.de • softwareok.com • softwareok.com • softwareok.eu
0.077


► What is converting? ◄

► Restore Desktop Icons Problem in Desktop-OK and Overwrite! ◄

► Prevent Recovery of deleted files under Windows 10 / 8.1 without additional software! ◄

This website uses cookies to ensure you get the best experience on our website more Infos & Privacy Policy
....