Is there by chance a function in C# that can be used just like the built-in
Mid(str,z,z) in VB? 10 18648
I think Microsoft.VisualBasic.Interaction.Mid( , ); should work.
"Tom J (Darth)" <tj****@airmail.net> wrote in message
news:#H*************@TK2MSFTNGP11.phx.gbl... Is there by chance a function in C# that can be used just like the
built-in Mid(str,z,z) in VB?
There are equivalent method in C# string class. Couldn't remember
exactly what is the method name, but it is there.
Tom J (Darth) wrote: Is there by chance a function in C# that can be used just like the built-in Mid(str,z,z) in VB?
"Tom J \(Darth\)" <tj****@airmail.net> wrote in
news:#H*************@TK2MSFTNGP11.phx.gbl: Is there by chance a function in C# that can be used just like the built-in Mid(str,z,z) in VB?
System.String.Substring
Chris.
-------------
C.R. Timmons Consulting, Inc. http://www.crtimmonsinc.com/
String.SubString()
"Jonathan" <da***********@yahoo.com> дÈëÓʼþ
news:O2**************@TK2MSFTNGP10.phx.gbl... There are equivalent method in C# string class. Couldn't remember exactly what is the method name, but it is there.
Tom J (Darth) wrote:
Is there by chance a function in C# that can be used just like the
built-in Mid(str,z,z) in VB?
"William Ryan" <do********@nospam.comcast.net> wrote in message news:Ou**************@tk2msftngp13.phx.gbl... I think Microsoft.VisualBasic.Interaction.Mid( , ); should work.
Better to avoid the Visual Basic functions.
--
Michael Culley
"Tom J (Darth)" <tj****@airmail.net> wrote in message news:#H*************@TK2MSFTNGP11.phx.gbl... Is there by chance a function in C# that can be used just like the built-in Mid(str,z,z) in VB?
William Ryan <do********@nospam.comcast.net> wrote: I think Microsoft.VisualBasic.Interaction.Mid( , ); should work.
That reduces portability to other implementations, however, and doesn't
exactly produce idiomatic C# - using String.Substring is far
preferable, IMO.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Michael,
I am curious, why do you say that?
--
- Nicholas Paldino [.NET/C# MVP]
- casper(1 spelled out){at)caspers(where I live, rhymes with
mouse)<dot]com
"Michael Culley" <mc*****@NOSPAMoptushome.com.au> wrote in message
news:Of**************@TK2MSFTNGP12.phx.gbl... "William Ryan" <do********@nospam.comcast.net> wrote in message
news:Ou**************@tk2msftngp13.phx.gbl... I think Microsoft.VisualBasic.Interaction.Mid( , ); should work.
Better to avoid the Visual Basic functions.
-- Michael Culley
"Tom J (Darth)" <tj****@airmail.net> wrote in message news:#H*************@TK2MSFTNGP11.phx.gbl... Is there by chance a function in C# that can be used just like the built-in Mid(str,z,z) in VB?
Thanks to all for your input. I am finding that the following statement:
if Mid(Record.GetString(2),1,1) != "9"
Causes a red underscore to appear under Mid and after the quoted string
variable (in this case "9") when I enter this statement under VS .NET Studio
2003. I believe the (String.Substring function) is a better option at this
point. My resolved statement looks something like this:
if (Record.GetString(2).Substring(0,1) != "9")
I'll keep you guys posted as to the outcome of this trial when I try to
Build and run my project.
Thanks again....Tom J
"Michael Culley" <mc*****@NOSPAMoptushome.com.au> wrote in message
news:Of**************@TK2MSFTNGP12.phx.gbl... "William Ryan" <do********@nospam.comcast.net> wrote in message
news:Ou**************@tk2msftngp13.phx.gbl... I think Microsoft.VisualBasic.Interaction.Mid( , ); should work.
Better to avoid the Visual Basic functions.
-- Michael Culley
"Tom J (Darth)" <tj****@airmail.net> wrote in message news:#H*************@TK2MSFTNGP11.phx.gbl... Is there by chance a function in C# that can be used just like the built-in Mid(str,z,z) in VB?
news:#i**************@tk2msftngp13.phx.gbl...> Michael, I am curious, why do you say that?
This is a few reasons I can think of. If you used the vb functions the world won't grid to a halt but I think it is better not to
use them.
Easier to transfer code to other languages.
Consistancy with other programmers.
There would be a small speed difference because the VB library would need to be loaded.
--
Michael Culley
Tom,
The Substring method of the String object should do the trick. It's not a
static method, so call it against the string object you want to parse.
HTH,
Nicole
"Tom J (Darth)" <tj****@airmail.net> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl... Is there by chance a function in C# that can be used just like the
built-in Mid(str,z,z) in VB?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ken VdB |
last post by:
Hi everyone,
Is there a reason why the Mid() function only works in one direction in
VBScript? This code works in VB6 but not in VBScript? Is there a way
around it? I am trying to create an...
|
by: Jack Sirulnikoff |
last post by:
Hi,
I'm trying to write some javascript to set up a series of MIDI files as
background using <EMBED>. I can get it to work in general, but the main
problem I have is:
what coding can be used...
|
by: Nawab |
last post by:
Hey can anyone explain to me the difference between Mid and Mid$ ....i
notice sometimes when i a running the update query with Mid$ it tells
me that for example 3 records will be updated ( which in...
|
by: martlaco1 |
last post by:
Trying to fix a query that (I thought) had worked once upon a time, and
I keep getting a Data Type Mismatch error whenever I enter any criteria
for an expression using a Mid function. Without the...
|
by: Andy_Khosravi |
last post by:
Hello,
I'm having a problem with the MID function within Access 97. I have
been trying to build a function to check to make sure that a field on a
form does not have any spaces or dashes. This...
| |
by: A.M |
last post by:
Hi,
Using C#, what is the equivalent of functions Left, Right and Mid that we
had in vb6?
Thanks,
Alan
|
by: Phil C. |
last post by:
Hi,
I'm using Access 2000.
I have a Select Query that uses the MID function to separate the actual text
of articles from the title of the articles. The articles are enterd into
the...
|
by: Lee Xuzhang |
last post by:
/* from SICP -- Exercise 4.21:
((lambda (n)
((lambda (fact)
(fact fact n))
(lambda (ft k)
(if (= k 1)
1
(* k (ft ft (- k 1)))))))
10)
*/
|
by: sridhard2406 |
last post by:
Hi All,
I am new to c++, please find my program below and my doubt as mentioned below.
#include <iostream>
using namespace std;
class base
{
public:
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |