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 » Newbie corner » From std::string to String
Re: From std::string to String [message #49460 is a reply to message #49458] Wed, 14 February 2018 21:20 Go to previous messageGo to previous message
Klugier is currently offline  Klugier
Messages: 1076
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello,

Try to create Upp::String basing on std::string like this:
String(fields[0]);


IMO, you should use Core library to deal with text files. The easiest way is to use LoadFile(path):
Upp::String fileContent = Upp::LoadFile("PathToTextFile.txt");

// now you could use some powerfull functions from Core like Split;
Upp::Vector<String> fileContentLines = Upp::Split(fileContent, "\n");
for (const String& line : fileContentLines) {
    // Loop over the line...
}


I will start from rewriting you code from standard library into Upp approch. This could save you problems with file encoding conversion.

Sincerely,
Klugier


U++ - one framework to rule them all.

[Updated on: Wed, 14 February 2018 21:27]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Filtering CR from an EditString
Next Topic: MSSQL and codepage
Goto Forum:
  


Current Time: Tue May 07 19:15:43 CEST 2024

Total time taken to generate the page: 0.02732 seconds