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.

string myText = abcdefg" 
System.SubString(0, myText.Length - 1) = "abcdefg"
myText.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 !!

string myText = "01/03/2004"; 
myText.IndexOf("/") = 2
myText.SubString(0, sSomeText.IndexOf("/")) = "01"

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

Removing the last character

string myText; 
myText = myText.SubString(0, myText.Length - 1);

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