0
How to write the last 3 characters of a string variable in new variable?
I have string variable FirsrtVar = "012345", I need take "345" from this variable and write in SecondVar. How to do it? (Sorry, I'm not english-speaker)
5 Answers
+ 2
Albert , you can use Substring method for example. Look at the code đ±
https://code.sololearn.com/cimkWbs77Ebp/?ref=app
+ 2
Using Substring method.
string firstVar = "012345";
string secondVar =
firstVar.Substring(3);
Substring is used like this:
str.Substring( starting index, ending index) - if the second index is not provided, the string will go until the end
+ 2
a little tutorial:
https://www.google.com/amp/s/www.geeksforgeeks.org/c-sharp-substring-method/amp/
SecondVar = FirstVar.Substring(3).
//"345"
+ 1
I 2 hours searched information in Google and solved a problem for 5 minutes here)
0
Thank you)