In VBA Access, I get a short string from long string by line below:
tmpStr1,tmpStr2 as string;
tmpStr1 = "abcdefgh"
tmpStr2 = Mid(tmmStr1,3,1) 'result is c
How to do same in C#?
try to do this.
var tmpStr1 = "abcdefgh";
var tmpStr2 = tmpStr1.Substring(3, 1);
Console.WriteLine(tmpStr2);
https://dotnetfiddle.net/WpDrpk
Use Substring
in c#
string.Substring( int startIndex, int length );
you need to do that like this
tmpStr2 = Substring(tmmStr1,2,1)
https://msdn.microsoft.com/en-us/library/aka44szs(v=vs.110).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With