trim away the first letter in string?
-
Hi all, How would i go about trimming the first character in a string? Example: I want to add "+27" to the Variable that contains "0721234567". But first i need to delete the "0" from the Variable. So then the Variable will contain "+27721234567". Thank you in advance. :)
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
-
Hi all, How would i go about trimming the first character in a string? Example: I want to add "+27" to the Variable that contains "0721234567". But first i need to delete the "0" from the Variable. So then the Variable will contain "+27721234567". Thank you in advance. :)
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
hi dim str as string = "0721234567" dim strNew as string = str.Substring(1) str = "+27" & strNew
Tamimi - Code
-
Hi all, How would i go about trimming the first character in a string? Example: I want to add "+27" to the Variable that contains "0721234567". But first i need to delete the "0" from the Variable. So then the Variable will contain "+27721234567". Thank you in advance. :)
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
Ok
string strNumber="0721234567"; string strPreCode="+27"; strNumber = strPreCode + strNumber.Substring(1,strNumber.Length-1);
this code add PreCode(+27) to first of Number(0721234567), but first remove zero(0) from first position of Number. -
hi dim str as string = "0721234567" dim strNew as string = str.Substring(1) str = "+27" & strNew
Tamimi - Code
Thank you for your time.
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
-
Ok
string strNumber="0721234567"; string strPreCode="+27"; strNumber = strPreCode + strNumber.Substring(1,strNumber.Length-1);
this code add PreCode(+27) to first of Number(0721234567), but first remove zero(0) from first position of Number.Thank you for your time.
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
-
Hi all, How would i go about trimming the first character in a string? Example: I want to add "+27" to the Variable that contains "0721234567". But first i need to delete the "0" from the Variable. So then the Variable will contain "+27721234567". Thank you in advance. :)
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
hi , string s = "0721234567"; if(s.StartsWith("0")) s= s.Replace("0","+27"); cheers.