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 The provided code defines a function called SearchCmdLPCITEMIDLIST,
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   This example demonstrates using the CreateNewImageList
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
  + Security

  + 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
  + PreventTurnOff
  + QuickMemoryTestOK
  + IsMyHdOK
  + AutoPowerOptionsOK
  + OneLoupe
  + TraceRouteOK
  + GetWindowText
  + AutoHideMouseCursor
  + Desktop.Calendar.Tray.OK
  + PAD-s


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

 © 2025 by Nenad Hrg softwareok.de • softwareok.com • softwareok.com • softwareok.eu


► Protect your hardware on the computer! ◄
► Zoom and Dark Theme Visually Impaired and Eye Friendly! ◄
► Folder content appears delayed in Windows-10? ◄
► Easy Share the folder with everyone on Windows 11? ◄


This website does not store personal data. However, third-party providers are used to display ads,
which are managed by Google and comply with the IAB Transparency and Consent Framework (IAB-TCF).
The CMP ID is 300 and can be individually customized at the bottom of the page.
more Infos & Privacy Policy

....