0

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.

7
Contributors
17
Replies
18
Views
10 Years
Discussion Span
Last Post by Hamrick
0

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.

0

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.

0

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.

0

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.

0

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. :)

0

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 ); 
}
0

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.

0

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......;)

0

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.

0

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;
}
0

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

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.