3DCoat Core API
The 3DCoat API documentation.
No Matches

 * Simple strings manipulations

// Simple strings manipulations
#include <CoreAPI.h>
//If you need the release build at full speed please change the Debug below to Release
//@config: Debug
//this function just displays the string
void show(const char* string) {
// The main() will be called as soon as user will run the script
int main(){
// There is multiple types of strings in c++, just the sort of zoo
// This is c-style sctring
const char* cs = "c-string";
// this is c++ type string
std::string cpps = "cpp-string";
// this is c++ Unicode string
std::wstring cppw = L"Unicode string☺";
// if you use special characters, save the file with the UTF-8 encoding
// This is the native 3DCoat string:
coat::str coatstr = "3DCoat supports all types of strigs: ";
// You may use all strings types, but it is better to use 3DCoat native string
// because it is very functionally rich and compatible with other strings types.
// There we concatenate all that strings
coatstr << cs << ", " << cpps.c_str() << ", " << cppw.c_str();
// show what we got
// We recommend using the c string (const char*) and native 3DCoat strings coat::str whenever possible
// They both are well compatible between each other.
float fv = 1.252345f;
int iv = 1234;
// clear the string
coatstr << "Format values using the << operator: float: " << fv << ", int: " << iv;
coatstr << coat::str::Format("Format values using the Format function: float: %.04f, int: %d", fv, iv);
coatstr << "Different float precission: " << coat::str::ToString(fv,1) << " " << coat::str::ToString(fv, 2) << " " << coat::str::ToString(fv, 3);
// let we got some path
path << "Log.txt";
show("Let we got some path: " + path);
show("Filepath: " + path.GetFilePath());
show("Filepath: " + path.GetFileName());
return 0;
the rich dialog. You may customize it, show your custom parameters and custom buttons.
Definition CoreAPI.h:1493
dialog & ok()
add Ok button
int show()
Show the dialog. This is usually the last command in the chain.
dialog & text(const char *id)
pass the header text of the dialog
static const char * dataPath()
the 3DCoat data path
comms::cStr str
the string that is compatible with the 3DCoat engine, see the cStr
Definition CoreAPI.h:34