Skip to content
Loading
  • James Axsom
    0
    Hi Sona,
     
    I believe what is happening is your basing your substrings as if the starting index is 1. Sub string index start at 0.
     
    Let’s examine how your code executes when the parameter ycode comes into the function.
    ycode =”2012-13”
     
    Substring(1,4) would produce 012- as opposed to 2012.
     
    In order to get 2012 your substring would need to be Substring(0,4).
     
    SubString(3,2) produces 2-. In order to get 12 you would need Substring(2,2)
     
    Zero based indexes
    Value: 2012-13
     
    Indexes: 0123456
     
    Check your other substrings.
     
    Hope this helps you.
    0