What is the C# equivalent of Left in VB6? I'm not sure how to translate
this line of code :
strResultCode = Left$(txtOutput, InStr(1, txtOutput, ",") - 1)
Any help would be really appreciated.
Cheers,
Mike
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! 4 6171
Use:
string.Substring(start, length);
ie:
string something = "this is,my text";
string newString = something.Substring(0, something.IndexOf(","));
"Mike P" <mr*@telcoelectronics.co.uk> wrote in message
news:Oo**************@TK2MSFTNGP11.phx.gbl... What is the C# equivalent of Left in VB6? I'm not sure how to translate this line of code :
strResultCode = Left$(txtOutput, InStr(1, txtOutput, ",") - 1)
Any help would be really appreciated.
Cheers,
Mike *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
I presume you're looking to take all the string characters to the left of
the ","?
SubString does quite well here...
int CommaIndex = Output.IndexOf ( ',' );
if ( CommaIndex >= 0 )
{
// comma found
ResultString = Output.SubString ( 0, CommaIndex );
}
else
{
// for a case with no ,
ResultString = Output; // or ""?
}
"Mike P" <mr*@telcoelectronics.co.uk> wrote in message
news:Oo**************@TK2MSFTNGP11.phx.gbl... What is the C# equivalent of Left in VB6? I'm not sure how to translate this line of code :
strResultCode = Left$(txtOutput, InStr(1, txtOutput, ",") - 1)
Any help would be really appreciated.
Cheers,
Mike *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
strResultCode = txtOutput.Substring(0, txtOutput.IndexOf(",", 0));
*-----------------------*
Posted at: www.GroupSrv.com
*-----------------------*
Thanks Ben, Dan!
Cheers,
Mike
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Michael Foord |
last post by:
Please pardon my ignorance on this one - but I'm not certain how the
sign bt is treated in python bitwise operators. I've trying to convert
a javascript DES encryption routine into python.
...
|
by: JBBHF |
last post by:
Hi i'm working on a web project, and i would like to make my oracle
query work in mysql.
select match.numero "nummatch",
to_char(match.datematch, 'yyyy-MM-dd') "datematch",
p1.numjoueur "j1",...
|
by: junky_fellow |
last post by:
Is *ptr++ equivalent to *(ptr++) ?
|
by: Tim Soliday |
last post by:
I have been looking at regular expressions lately, and I'm hoping that
maybe someone could help me?
I am trying to find the position of a substring, and then returning the
substring including...
|
by: NathanC |
last post by:
Left('ironman',4)
Result - 'iron'
Is there anyway to excute this task in VB.NET? Currently, I am determing the
value of the 4th character, splitting on that, then grabbing the value of the...
|
by: grid |
last post by:
Hi,
I have a certain situation where a particular piece of code works on a
particular compiler but fails on another proprietary compiler.It seems
to have been fixed but I just want to confirm if...
|
by: Tasman |
last post by:
Is there an equivalent of valign="bottom" for a table within a DIV
using CSS?
I've found I can center a table of buttons in a DIV with
{margin-left:auto; margin-right:auto}. But I am unsure how...
|
by: tlemcenvisit |
last post by:
Hello,
Please, what is the equivalent code of
if(e.Button == MouseButtons.Left)
in VC++.NET
Thanks in advance
|
by: AJ |
last post by:
Hi all, I have the following query which isn't quite finished!
1) How do i specify the '@Country' parameter is optional in an ACCESS stored
query? (like MSSQL @Country INT = NULL)
2) What is...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |