Member Avatar for iamthwee

If you use C++ strings your life would be much simpler coz then you can do something like:

#include <string> 
 
const std::string whiteSpaces( " \f\n\r\t\v" ); 
 
void trimRight( std::string& str, 
       const std::string& trimChars = whiteSpaces ) 
 { 
    std::string::size_type pos = str.find_last_not_of( trimChars ); 
    str.erase( pos + 1 ); 
 
} 
 

void trimLeft( std::string& str, 
       const std::string& trimChars = whiteSpaces ) 
 { 
    std::string::size_type pos = str.find_first_not_of( trimChars ); 
    str.erase( 0, pos ); 
 } 
 

void trim( std::string& str, const std::string& trimChars = whiteSpaces ) 
 { 
    trimRight( str, trimChars ); 
    trimLeft( str, trimChars ); 
 }

Is it just me or is dat syntax highlighting really bad. That bright blue is annoying. Yucky.

Recommended Answers

All 17 Replies

Is it just me or is dat syntax highlighting really bad. That bright blue is annoying. Yucky.

Ditto here, it makes my eyes hurt. Dont know how this color got approved.

Member Avatar for iamthwee

Ditto here, it makes my eyes hurt. Dont know how this color got approved.

I don't know, perhaps you can ask dani to change it?
In fact it wouldn't be such a bad idea if it were got rid off altogether. Hmm, oh well.

I don't know, perhaps you can ask dani to change it?
In fact it wouldn't be such a bad idea if it were got rid off altogether. Hmm, oh well.

I have. No support.

I don't know, perhaps you can ask dani to change it?

Naa already have asked alot of things from Miss Dani. Keep bugging here everyday with this and that... One more request and I surely would put her in rage mode.

I have. No support.

Was the suggestion via a PM ? IF so how are we supposed to support you? No thread as such related to C++ color schemes.

No. http://www.daniweb.com/techtalkforums/thread59169.html

But Miss Dani didnt even reply in that thread. So whats the point in supporting when she didnt comment on your effort ? Maybe she is fed up of too many suggestions or maybe a lot of money has gone into it to change it or maybe the cost or some more hidden reason.

Gentlemen, let's continue this in the Community Feedback forum shall we?I am moving the posts regarding the syntax highlighting to a new thread. :)

You guys should be using code=cplusplus instead of code=cpp. :)

#include <string> 
 
const std::string whiteSpaces( " \f\n\r\t\v" ); 
 
void trimRight( std::string& str, 
const std::string& trimChars = whiteSpaces ) 
{ 
     std::string::size_type pos = str.find_last_not_of( trimChars ); 
     str.erase( pos + 1 ); 
} 
 
 
void trimLeft( std::string& str, 
const std::string& trimChars = whiteSpaces ) 
{ 
     std::string::size_type pos = str.find_first_not_of( trimChars ); 
     str.erase( 0, pos ); 
} 
 
 
void trim( std::string& str, const std::string& trimChars = whiteSpaces ) 
{ 
     trimRight( str, trimChars ); 
     trimLeft( str, trimChars ); 
}
Member Avatar for iamthwee

You guys should be using code=cplusplus instead of code=cpp. :)

#include <string> 
 
const std::string whiteSpaces( " \f\n\r\t\v" ); 
 
void trimRight( std::string& str, 
const std::string& trimChars = whiteSpaces ) 
{ 
     std::string::size_type pos = str.find_last_not_of( trimChars ); 
     str.erase( pos + 1 ); 
} 
 
 
void trimLeft( std::string& str, 
const std::string& trimChars = whiteSpaces ) 
{ 
     std::string::size_type pos = str.find_first_not_of( trimChars ); 
     str.erase( 0, pos ); 
} 
 
 
void trim( std::string& str, const std::string& trimChars = whiteSpaces ) 
{ 
     trimRight( str, trimChars ); 
     trimLeft( str, trimChars ); 
}

Ha ha, silly SOS and his typos. Dearie me.

You guys should be using code=cplusplus instead of code=cpp.

So how does the keyword "cpp" gets parsed. It means that like cplusplus even cpp is a valid token ? I thought if I typed the code type wrongly it would simply igore the code tags. So is "cpp" not wrong ?

Ha ha, silly SOS and his typos. Dearie me.

Grrr......;)

Generally you're right but 'cpp' is a legacy definition that I never got around to deleting. :) You're meant to use the same language names as in the code snippet library.

Generally you're right but 'cpp' is a legacy definition that I never got around to deleting. :) You're meant to use the same language names as in the code snippet library.

But why type cplusplus when cpp is shorter? And why such different color coding for cplusplus vs cpp vc c.
I definitely prefer the colors of CPP best, at least with this short test:

Code Tag = c
#include <iostream>
using namespace std;
int main()
{
    int arr[3] = { 5, 10, 15 };
    int* ptr = arr;
    int i;

    for (i=0; i<3; i++) cout << arr[i] << " "; cout << endl;
    
    *ptr = 10;          // set arr[0] to 10
    *(ptr + 1) = 20;      // set arr[1] to 20
    ptr += 2;
    ptr[0] = 30;        // set arr[2] to 30

    for (i=0; i<3; i++) cout << arr[i] << " "; cout << endl;
    while (ptr >= arr)
    {
        ptr--;
        cout << ' ' << *ptr;    // print values
    }
    cout << endl;
    return 0;
}
Code Tag = cpp
#include <iostream>
using namespace std;
int main()
{
    int arr[3] = { 5, 10, 15 };
    int* ptr = arr;
    int i;

    for (i=0; i<3; i++) cout << arr[i] << " "; cout << endl;
    
    *ptr = 10;          // set arr[0] to 10
    *(ptr + 1) = 20;      // set arr[1] to 20
    ptr += 2;
    ptr[0] = 30;        // set arr[2] to 30

    for (i=0; i<3; i++) cout << arr[i] << " "; cout << endl;
    while (ptr >= arr)
    {
        ptr--;
        cout << ' ' << *ptr;    // print values
    }
    cout << endl;
    return 0;
}
Code Tag = cplusplus
#include <iostream>
using namespace std;
int main()
{
    int arr[3] = { 5, 10, 15 };
    int* ptr = arr;
    int i;

    for (i=0; i<3; i++) cout << arr[i] << " "; cout << endl;
    
    *ptr = 10;          // set arr[0] to 10
    *(ptr + 1) = 20;      // set arr[1] to 20
    ptr += 2;
    ptr[0] = 30;        // set arr[2] to 30

    for (i=0; i<3; i++) cout << arr[i] << " "; cout << endl;
    while (ptr >= arr)
    {
        ptr--;
        cout << ' ' << *ptr;    // print values
    }
    cout << endl;
    return 0;
}

Because 'cplusplus' is just what so happened to have been started in the Code Snippets library once upon a time.

Sorry to drag this one up, but should proper use of these tags be documented here?

Yeah, for some forums like vb.net and C#, i don't even know what name to use. some kind of documentation would be great.

Do all of those languages have syntax highlighting? The vbnet highlighting doesn't really work. Most of the keywords aren't highlighted at all...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.