SubString(0, sconcat.Length - 1) 

Retrieves a substring from this instance. The substring starts at a specified character position.
An index is the position of a character within a string, and is counted starting from the first character in the string, which is index position zero. That is, a string index is said to be zero-based.

Dim sText = abcdefg" 
SubString(0, sText.Length - 1) = "abcdefg"
SubString(0, 1) = "a"

String.IndexOf(value, startindex)

value - (string) the substring you are looking for
startindex - (int32) this starts at 0.

Reports the index of the first occurrence of a String, or one or more characters, within this instance.
This returns -1 if the substring does not exist !!

Dim sSomeText As String = "01/03/2004" 
sSomeText.IndexOf("/") = 2
sSomeText.SubString(0, sSomeText.IndexOf("/")) = "01"

The IndexOf method is case sensitive
The Index is 0-based.

Removing the last character

Dim sText As String 
sText = sText.SubString(0, sText.Length - 1)

© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext