find value after space in string
-
Hi, I get a string say "07915 25D3". The problem is, the value before the space can be anything from 1 - 12 in length, and the value after the space anything from 2 - 12 characters. I just need to get the value after the space, "25D3", in the string. I am not sure how to do this.
-
Hi, I get a string say "07915 25D3". The problem is, the value before the space can be anything from 1 - 12 in length, and the value after the space anything from 2 - 12 characters. I just need to get the value after the space, "25D3", in the string. I am not sure how to do this.
Hi assuming the character is always a space you could use the split() function: ----------------------------------------------------------
Dim _str As String = "07915 25D3" dim _s as string = str.Split(" ")(1).ToString
---------------------------------------------------------- In this instance _s will give you the value 25D3. The argument passed into the split function is a character or number of characters are used to break down the string into an array. The value of _s is evaluated to the 2nd element of the array (25D3) Hope this helps:) MJ -
Hi assuming the character is always a space you could use the split() function: ----------------------------------------------------------
Dim _str As String = "07915 25D3" dim _s as string = str.Split(" ")(1).ToString
---------------------------------------------------------- In this instance _s will give you the value 25D3. The argument passed into the split function is a character or number of characters are used to break down the string into an array. The value of _s is evaluated to the 2nd element of the array (25D3) Hope this helps:) MJ -
Hi, I get a string say "07915 25D3". The problem is, the value before the space can be anything from 1 - 12 in length, and the value after the space anything from 2 - 12 characters. I just need to get the value after the space, "25D3", in the string. I am not sure how to do this.
There is one another way to do it. suppose your string is stored in variable 'strCustId'. String strRightText = strCustID.Substring(strCustID.IndexOf(" "));