Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » U++ community news and announcements » CParser::GetSpacePtr
CParser::GetSpacePtr [message #34646] Sat, 03 December 2011 11:29
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
It is a very minor feature, but can be handy (it is in W++ template system Wink.

CParser normally eats whitespaces after each token. I have now added GetSpacePtr that returns a pointer at the start of these whitespaces:

#include <Core/Core.h>

using namespace Upp;

CONSOLE_APP_MAIN
{
	CParser p("  someid     $$      and");
	LOG("GetPtr:      " << AsCString(p.GetPtr()));
	LOG("GetSpacePtr: " << AsCString(p.GetSpacePtr()));
	p.Id("someid");
	LOG("GetPtr:      " << AsCString(p.GetPtr()));
	LOG("GetSpacePtr: " << AsCString(p.GetSpacePtr()));
	p.Char('$');
	LOG("GetPtr:      " << AsCString(p.GetPtr()));
	LOG("GetSpacePtr: " << AsCString(p.GetSpacePtr()));
	p.Char('$');
	LOG("GetPtr:      " << AsCString(p.GetPtr()));
	LOG("GetSpacePtr: " << AsCString(p.GetSpacePtr()));
}


GetPtr:      "someid     $$      and"
GetSpacePtr: "  someid     $$      and"
GetPtr:      "$$      and"
GetSpacePtr: "     $$      and"
GetPtr:      "$      and"
GetSpacePtr: "$      and"
GetPtr:      "and"
GetSpacePtr: "      and"
Previous Topic: Sql: New 'Of' 'syntax'
Next Topic: Custom build steps upgrade
Goto Forum:
  


Current Time: Fri Apr 19 05:48:43 CEST 2024

Total time taken to generate the page: 0.02095 seconds