Substring2 function needs 2 parameters.
- The first one is the beginning position in the source string(from 0),
- And the second one would have to be the ending position (from 0). But in fact it is not, we have to add 1 to this position.
Why the ending position is not the true ending position, synthax would be better. Is there any useful reason for that?
If you look at the help file: 'Returns a new string which is a substring of the original string. The new string will include the character at BeginIndex and will extend to the character at EndIndex, not including the last character.'
Substring2 function needs 2 parameters.
- The first one is the beginning position in the source string(from 0),
- And the second one would have to be the ending position (from 0). But in fact it is not, we have to add 1 to this position.
Why the ending position is not the true ending position, synthax would be better. Is there any useful reason for that?
Yes i understand any decision taken by the creator of B4A, since he does what he wants.
I only say that it would be more evident that the ending position would be the last character position of the source string, rather than the last + 1, otherwise why the starting position is not the starting +1?
I think it may be a bug in the substring2 function for that reason. Be sure that i love B4A, and i respect very much its creators.
(I am lcreator or Pluton Language for mainframes).
No, it's how Java, which the language that Android applications are written in and what Basic4android is compiled into, implements specifying character spans in its string methods.
My background is in vb.net, and I'm just getting started with B4A. I've been excited to find a software that allows me to get my feet wet with mobile app development while using coding and an IDE that are familiar.
I will say that with regards to substring2 I'm a little bit confused.
if a string has 3 characters, with indexes 0,1 and 2 and I want to select the last two characters using substring2, then do I use endindex=3?
My background is in vb.net, and I'm just getting started with B4A. I've been excited to find a software that allows me to get my feet wet with mobile app development while using coding and an IDE that are familiar.
I will say that with regards to substring2 I'm a little bit confused.
if a string has 3 characters, with indexes 0,1 and 2 and I want to select the last two characters using substring2, then do I use endindex=3?
SubString (BeginIndex As Int) As String
Returns a new string which is a substring of the original string.
The new string will include the character at BeginIndex and will extend to the end of the string.