Need help about this codes! Confusing.

Discussion in 'Programming' started by sdas, May 8, 2012.

  1. #1
    Dear gururs,
    I have a questions about a short codes. I do not understand what it means. Need help to explain in simple words.

    suffix = StringSubstr(Symbol(),6,StringLen(Symbol())-6);

    What is the meaning of this code above?

    The whole code is:
    int init()
    {

    balance = AccountBalance();
    suffix = StringSubstr(Symbol(),6,StringLen(Symbol())-6);
    for(int a = 0; a < ArraySize(pairs); a++)
    {
    pairs[a] = pairs[a] + suffix;

    //pairTrend[a] = "FLAT";
    //pairTrendB4[a] = "FLAT";
    }

    if (showScreenComments) Comment("\nWaiting for tick update on ",pair[0]," ...");

    return(0);

    }

    Thanks for any help!! ;)
     
    sdas, May 8, 2012 IP
  2. nikomaster

    nikomaster Member

    Messages:
    606
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    30
    #2
    Never heard about the function StringSubStr but I assume it retrieves a sub-string from the value returned by the function Symbol() which assume it returns a string. The sub-string starts at character 6 (or 7 if it is based on 0) and ends at the size of the string minus six.

    So if Symbol returns "This-is-a-weird-function"
    the StringSubStr would return this string:

    "s-a-weird-fu"

    I hope this helped you.
     
    nikomaster, May 8, 2012 IP