0

substring and substr confusion in the documentation

Hi,

I was just reading through your manual and noticed the documentation for substring and substr is a little confusing....

 

substring(string, start, end) – Extracts a part of the string. Start and end are zero-based.

 

substr("Hello World!", 0, 5) => "Hello"

 

substr("Hello World!", 6, 10) => "World"

 

substr(string, start, length) – Extracts a part of the string. Start is zero-based.

 

substring("Hello World!", 0, 5) => "Hello"

 

substring("Hello World!", 6, 5) => "World"

 

The function descriptions probably need flipping around to read as follows:

substr(string, start, length) – Extracts a part of the string. Start is zero-based.

 

substr("Hello World!", 0, 5) => "Hello"

 

substr("Hello World!", 6, 10) => "World"

substring(string, start, end) – Extracts a part of the string. Start and end are zero-based.

 

substring("Hello World!", 0, 5) => "Hello"

 

substring("Hello World!", 6, 5) => "World"

 

On a different note, I'm absolutely loving Ninox!!

 

Kind Regards,

Chris. 

Reply

null

Content aside

  • 6 yrs agoLast active
  • 2528Views