On Tue, 1 Apr 2008 08:02:04 -0700 (PDT), cmdolcet69
<co************@hotmail.comwrote:
>On Apr 1, 10:51*am, kimiraikkonen <kimiraikkone...@gmail.comwrote:
>On Apr 1, 5:37 pm, cmdolcet69 <colin_dolce...@hotmail.comwrote:
What string function will cut off the last 3 characters from a string?
For example: if I had the string,
dim strtext as string = testcalls
I want to only return the strtext as test and take off the calls.
Substring function.
Your example is not well-formed but i guess it's:
Dim strtext As String = "testcalls"
To display only "test" chars from whole "testcalls" word;
Substring(0,4)
which defines 0 is startIndex point and 4 is the length that belongs
the length of "test".
What happends if i dont know the lenght. Because the lenght may change.
Dim strtext As String = "testcalls"
strtext = strtext.Substring(0, strtext.Length - 3)
But I think you really want 5 instead of 3 since "calls" is 5
characters long, not 3.
or:
strtext = strtext.Substring(0, strtext.Length - "calls".Length)
or
strtext = strtext.Remove(strtext.Length - "calls".Length)