hi there, how do I translate the following vb code to C#? I know to use
Indexof, but what would be for """"? Thanks!
InStr(1, sDocName, """") 4 1966
mystring.Indexo f("\"\"");
--
2004 and 2005 Microsoft MVP C#
Robbe Morris http://www.robbemorris.com http://www.masterado.net/home/listings.aspx
"cloudx" <cl****@discuss ions.microsoft. com> wrote in message
news:F3******** *************** ***********@mic rosoft.com... hi there, how do I translate the following vb code to C#? I know to use Indexof, but what would be for """"? Thanks!
InStr(1, sDocName, """")
"cloudx" <cl****@discuss ions.microsoft. com> wrote in message
news:F3******** *************** ***********@mic rosoft.com... hi there, how do I translate the following vb code to C#? I know to use Indexof, but what would be for """"? Thanks!
InStr(1, sDocName, """")
Hi, they are looking for a double quote char in the string, so you would use
"\"" in C#. Don't forget that VB indexes are 1-based, so the equivalent
index in C# would be 0 (assuming they didn't specify Option Base 0).
-- Alan
"Robbe Morris [C# MVP]" <in**@turnkeyto ols.com> wrote in message
news:OO******** *****@TK2MSFTNG P09.phx.gbl... mystring.Indexo f("\"\"");
Hi. Should be just "\"" not "\"\"". The two "" together in VB signify one
double quote.
-- Alan
1. IndexOf's 'start' parameter is 0-based, while InStr is 1-based.
2. If you're converting existing code, then you'll also have to add 1 to the
result since InStr's result is 1-based while IndexOf's result is 0-based.
So, unless you're rewriting the surrounding code (instead of just converting
it), the correct translation is:
i = sDocName.IndexO f("\"", 0) + 1;
David Anton www.tangiblesoftwaresolutions.com
Home of the Instant C# VB.NET to C# converter
and the Instant VB C# to VB.NET converter
"cloudx" wrote: hi there, how do I translate the following vb code to C#? I know to use Indexof, but what would be for """"? Thanks!
InStr(1, sDocName, """") This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Phill Long |
last post by:
this is the the code, now here is the final result.... I get one combo box
and
one tex box come up, but they are empty...
DAMN!!!
Any ideas on what Im doing wrong please..
Thanks Again
<?php require_once('..\library_database\Connections\onlinequote.php'); ?>
<?
|
by: Graham |
last post by:
On page 89 of Stroustrup's book "The C++ Programming Language" 3rd Ed.
He says that multidimensional arrays are best avoided outside
low-level code.
What precisely does he mean by low-level code? That is fairly
relative terminology.
Is he saying that the use of multidimensional arrays in C++ are not
desirable? That doesn't seem right to me.
|
by: apple |
last post by:
UDBV8 fp 6a - AIX 5.1
We have scheduled cron jobs to do backups. Periodically and starting to
occur more frequently, a backup fails with this error:
SQL2072N Unable to bind the shared library "". Reason code: "".
We are backing up to a file system on the server. Can't find anything
in the logs. We can manually resubmit the job 15 or 30 minutes later
and everything works fine. Any ideas on what might be happening? The
documentation on...
|
by: Wito |
last post by:
hi,
I want to backup database (db2, aix 5.1) using script. When I exec script
logging to user db2inst1 then is everything ok, but from cron, I get these
error:
SQL10007N Message "-1390" could not be retrieved. Reason code: "6".
Where is the problem?
|
by: kennethfine |
last post by:
I'm transitioning from ASP development, please excuse
these basic questions. One thing I did often in ASP was
create a "translate" function to render one string to
another, strip out excess carriage returns, etc.
I want to do the same thing in ASP.NET. I have a mail
component that will accept HTML, but it requires all HTML
to be listed on a single line. It takes the syntax:
msgObj.BodyParts.Add(" <html markup here> "),
| |
by: Mitan |
last post by:
Hello, I'm a beginner with what appears to be a simple question for
which I haven't been able to get an answer. Can someone explain what
"implementation code" is in relation to VB.NET? I want to be sure I
have a good understanding of this before I continue with my studies.
Thanks in advance.
Semper Fi
|
by: mike_li |
last post by:
On Window 2000 Professional Server
DB2 UDB
Level:
DB2 code release "SQL07029" with level identifie
"030A0105" and informational tokens "DB2 v7.1.0.98", "n040510" and
"WR21337".
In the db2diag.log,
----------------------------------------------------
2005-12-20-10.05.43.278000 Instance:MC Node:000
|
by: nan |
last post by:
Hi All,
I am trying to connect the Database which is installed in AS400
using DB2 Client Version 8 in Windows box.
First i created the Catalog,
then when i selected the connection type as ODBC, then i am getting
|
by: Nathan Sokalski |
last post by:
I recently converted some ASP.NET 1.1 projects of mine, created with Visual
Studio .NET 2003, to Web Application Projects in Visual Studio .NET 2005 so
that I could use ASP.NET 2.0 (All my ASP.NET is done using VB.NET). After
converting, everything was fine, and worked and compiled correctly, but I
noticed one big difference between the VB.NET code of the converted files in
the projects and the VB.NET code in new pages. The new pages use...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |