Click here to Skip to main content
14,421,828 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: Cleverest Code of the Day! Pin
Ehsan Sajjad24-Jan-18 7:03
professionalEhsan Sajjad24-Jan-18 7:03 
GeneralRe: Cleverest Code of the Day! Pin
Nish Nishant24-Jan-18 10:59
sitebuilderNish Nishant24-Jan-18 10:59 
GeneralRe: Cleverest Code of the Day! Pin
#realJSOP24-Jan-18 7:11
mva#realJSOP24-Jan-18 7:11 
GeneralRe: Cleverest Code of the Day! Pin
Ehsan Sajjad24-Jan-18 7:20
professionalEhsan Sajjad24-Jan-18 7:20 
JokeRe: Cleverest Code of the Day! Pin
Randor 24-Jan-18 9:05
professional Randor 24-Jan-18 9:05 
GeneralRe: Cleverest Code of the Day! Pin
Nish Nishant24-Jan-18 11:01
sitebuilderNish Nishant24-Jan-18 11:01 
GeneralRe: Cleverest Code of the Day! Pin
F-ES Sitecore24-Jan-18 7:17
mveF-ES Sitecore24-Jan-18 7:17 
GeneralRe: Cleverest Code of the Day! Pin
Z.C.M.24-Jan-18 8:54
professionalZ.C.M.24-Jan-18 8:54 
A consultant friend of mine who has been programming far longer than I have—he started programming on the early Macs and helped write the first music notation software for the Mac—doesn't see why C# should need to use .SubString() to get the left/right most characters from a string and instead wrote these. I don't really have a problem with this sort of thing. I just don't see the point, but that's just me.
public string LeftStringFunction(string sValue, int iMaxLength)
{
    //Check if the value is valid
    if (string.IsNullOrEmpty(sValue))
    {
        //Set valid empty string as string could be null
        sValue = string.Empty;
    }
    else if (sValue.Length > iMaxLength)
    {
        //Make the string no longer than the max length
        sValue = sValue.Substring(0, iMaxLength);
    }

    //Return the string
    return sValue;
}

public string RightStringFunction(string sValue, int iMaxLength)
{
    //Check if the value is valid
    if (string.IsNullOrEmpty(sValue))
    {
        //Set valid empty string as string could be null
        sValue = string.Empty;
    }
    else if (sValue.Length > iMaxLength)
    {
        //Make the string no longer than the max length
        sValue = sValue.Substring(sValue.Length - iMaxLength, iMaxLength);
    }

    //Return the string
    return sValue;
}
"...JavaScript could teach Dyson how to suck." -- Nagy Vilmos

GeneralRe: Cleverest Code of the Day! Pin
Richard Deeming24-Jan-18 9:49
communityengineerRichard Deeming24-Jan-18 9:49 
GeneralRe: Cleverest Code of the Day! Pin
Nish Nishant24-Jan-18 10:55
sitebuilderNish Nishant24-Jan-18 10:55 
GeneralRe: Cleverest Code of the Day! Pin
Richard Deeming25-Jan-18 9:45
communityengineerRichard Deeming25-Jan-18 9:45 
GeneralRe: Cleverest Code of the Day! Pin
Nish Nishant25-Jan-18 9:56
sitebuilderNish Nishant25-Jan-18 9:56 
GeneralRe: Cleverest Code of the Day! Pin
den2k8825-Jan-18 3:43
professionalden2k8825-Jan-18 3:43 
GeneralRe: Cleverest Code of the Day! Pin
Richard Deeming25-Jan-18 9:50
communityengineerRichard Deeming25-Jan-18 9:50 
GeneralRe: Cleverest Code of the Day! Pin
englebart25-Jan-18 3:02
professionalenglebart25-Jan-18 3:02 
GeneralRe: Cleverest Code of the Day! Pin
MSBassSinger25-Jan-18 8:41
professionalMSBassSinger25-Jan-18 8:41 
JokeRe: Cleverest Code of the Day! Pin
raddevus24-Jan-18 11:02
communityengineerraddevus24-Jan-18 11:02 
GeneralRe: Cleverest Code of the Day! Pin
Ehsan Sajjad24-Jan-18 19:57
professionalEhsan Sajjad24-Jan-18 19:57 
GeneralRe: Cleverest Code of the Day! Pin
Ehsan Sajjad26-Jan-18 1:42
professionalEhsan Sajjad26-Jan-18 1:42 
GeneralRe: Cleverest Code of the Day! Pin
Member 798912225-Jan-18 0:18
MemberMember 798912225-Jan-18 0:18 
JokeRe: Cleverest Code of the Day! Pin
Ehsan Sajjad25-Jan-18 1:42
professionalEhsan Sajjad25-Jan-18 1:42 
GeneralRe: Cleverest Code of the Day! Pin
obermd25-Jan-18 4:14
Memberobermd25-Jan-18 4:14 
GeneralRe: Cleverest Code of the Day! Pin
Ehsan Sajjad25-Jan-18 4:16
professionalEhsan Sajjad25-Jan-18 4:16 
GeneralRe: Cleverest Code of the Day! Pin
Gary Huck25-Jan-18 4:49
MemberGary Huck25-Jan-18 4:49 
GeneralRe: Cleverest Code of the Day! Pin
Ehsan Sajjad25-Jan-18 5:10
professionalEhsan Sajjad25-Jan-18 5:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.