473,385 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Replacement for StrReverse Function

I've removed the Microsoft.VisualBasic import from my VB.Net project and am
in the process of replacing the vb6 compatible calls with native .Net i.e.
system.datetime.now instead of Now, variable Is Nothing instead of
IsNothing(variable) etc. I cannot find a native .Net replacement for the
StrReverse function. Is anyone familiar with a quick fix?
Nov 20 '05 #1
22 4063
Hi John,

Here is the visualbasic.namespace.

http://msdn.microsoft.com/library/de...rykeywords.asp

Do not mix this up with the visualbasic compatible namespace

This is a full part of dotNet.

Cor
Nov 20 '05 #2
In article <uJ**************@tk2msftngp13.phx.gbl>, John Cobb wrote:
I've removed the Microsoft.VisualBasic import from my VB.Net project and am
in the process of replacing the vb6 compatible calls with native .Net i.e.
system.datetime.now instead of Now, variable Is Nothing instead of
IsNothing(variable) etc. I cannot find a native .Net replacement for the
StrReverse function. Is anyone familiar with a quick fix?


How 'bout something like this :)

Private Function ReverseString(ByVal input As String) As String
If Not IsNothing(input) Then
Dim chars() As Char = input.ToCharArray()
Array.Reverse(chars)
Return New String(chars)
End If
End Function

--
Tom Shelton [MVP]
Nov 20 '05 #3
Hi Tom,
If Not IsNothing(input) Then


Especialy that IsNothing(input) that is real the one.

:-))

Cor


Nov 20 '05 #4
Hi Cor,
At the Develop Mentor Architect Training event hosted by Microsoft in the
Dallas office this week the instructor was showing how some functions like
these are wrapped by .Net to allow backwards compatibility. If you use
ildasm to look at the intermediate language of your assembly you can see
where things like OnError Goto etc. generate more IL than if you use the
native .Net functionality. It was suggested there to remove the
Microsoft.VisualBasic import and replace functions like Asc, Left$,
StrReverse, etc. with true .Net commands to generate leaner, tighter code.
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi John,

Here is the visualbasic.namespace.

http://msdn.microsoft.com/library/de...rykeywords.asp
Do not mix this up with the visualbasic compatible namespace

This is a full part of dotNet.

Cor

Nov 20 '05 #5
Tom,
Yes, that will work and I'll probably use something like that if there's not
a native .Net function already available. I was just curious if this
functionality was already part of the framework.

"Tom Shelton" <to*@mtogden.com> wrote in message
news:OV**************@TK2MSFTNGP11.phx.gbl...
In article <uJ**************@tk2msftngp13.phx.gbl>, John Cobb wrote:
I've removed the Microsoft.VisualBasic import from my VB.Net project and am in the process of replacing the vb6 compatible calls with native .Net i.e. system.datetime.now instead of Now, variable Is Nothing instead of
IsNothing(variable) etc. I cannot find a native .Net replacement for the StrReverse function. Is anyone familiar with a quick fix?


How 'bout something like this :)

Private Function ReverseString(ByVal input As String) As String
If Not IsNothing(input) Then
Dim chars() As Char = input.ToCharArray()
Array.Reverse(chars)
Return New String(chars)
End If
End Function

--
Tom Shelton [MVP]

Nov 20 '05 #6
In article <O$**************@TK2MSFTNGP09.phx.gbl>, Cor Ligthert wrote:
Hi Tom,
If Not IsNothing(input) Then


Especialy that IsNothing(input) that is real the one.

:-))

Cor


Huh? I'm not following...

--
Tom Shelton [MVP]
Nov 20 '05 #7
In article <O$**************@TK2MSFTNGP09.phx.gbl>, Cor Ligthert wrote:
Hi Tom,
If Not IsNothing(input) Then


Especialy that IsNothing(input) that is real the one.

:-))

Cor


Actually, I think I would change the test to:

If Not IsNothing(input) AndAlso input.Length <> 0 Then
...
End If

--
Tom Shelton [MVP]
Nov 20 '05 #8
* "John Cobb" <jo*******@acxiom.com> scripsit:
I've removed the Microsoft.VisualBasic import from my VB.Net project and am
Are you ill?
in the process of replacing the vb6 compatible calls with native .Net i.e.
'Microsoft.VisualBasic' (in "Microsoft.VisualBasic.dll") doesn't include
"VB6 compatible calls", it simply includes VB.NET methods. The
compatibility functions are in the
'Microsoft.VisualBasic.Compatibility.VB6' namespace (in
"Microsoft.VisualBasic.Compatibility.dll").
system.datetime.now instead of Now, variable Is Nothing instead of
IsNothing(variable) etc.
'IsNothing' is not the same as 'Is Nothing'!
I cannot find a native .Net replacement for the
StrReverse function. Is anyone familiar with a quick fix?


I don't think that there is one. I would continue using VB.NET's
'StrReverse' function.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #9
In article <uk*************@TK2MSFTNGP09.phx.gbl>, John Cobb wrote:
Tom,
Yes, that will work and I'll probably use something like that if there's not
a native .Net function already available. I was just curious if this
functionality was already part of the framework.


Other the the VB.NET StrReverse function - then I'm not aware of it.
Unless it's lurking in System.Text.RegularExpressions - and I generally
avoid that namespace since the implementation is so slow...

--
Tom Shelton [MVP]
Nov 20 '05 #10
* Tom Shelton <to*@mtogden.com> scripsit:
In article <uJ**************@tk2msftngp13.phx.gbl>, John Cobb wrote:
I've removed the Microsoft.VisualBasic import from my VB.Net project and am
in the process of replacing the vb6 compatible calls with native .Net i.e.
system.datetime.now instead of Now, variable Is Nothing instead of
IsNothing(variable) etc. I cannot find a native .Net replacement for the
StrReverse function. Is anyone familiar with a quick fix?


How 'bout something like this :)

Private Function ReverseString(ByVal input As String) As String
If Not IsNothing(input) Then


LOL ;-)!

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #11
* Tom Shelton <to*@mtogden.com> scripsit:
If Not IsNothing(input) Then


Especialy that IsNothing(input) that is real the one.

:-))

Cor


Huh? I'm not following...


'IsNothing' is part of 'Microsoft.VisualBasic' and the OP doesn't want
to use this namespace ;-).

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #12
* "John Cobb" <jo*******@acxiom.com> scripsit:
Yes, that will work and I'll probably use something like that if there's not
a native .Net function already available. I was just curious if this
functionality was already part of the framework.


The Visual Basic .NET runtime actually /is/ part of the framework.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #13
Hi John,

Did you see OnError and Goto on the link I did send?

Are you sure it was not about the compatible namespace?

Cor


Nov 20 '05 #14
Dunno, I'll go back and check again. It's possible that I may be confusing
the two.

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:O0**************@tk2msftngp13.phx.gbl...
Hi John,

Did you see OnError and Goto on the link I did send?

Are you sure it was not about the compatible namespace?

Cor

Nov 20 '05 #15

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c6************@ID-208219.news.uni-berlin.de...
* "John Cobb" <jo*******@acxiom.com> scripsit:
I've removed the Microsoft.VisualBasic import from my VB.Net project and
am
Are you ill?

LOL. Not that I know of.
At the Develop Mentor Architect Training event hosted by Microsoft in
the Dallas office this week the instructor was showing how some functions
like
these are wrapped by .Net to allow backwards compatibility with vb6 and if
you use
ildasm to look at the intermediate language of your assembly you can see
where certain ones generate more IL than native .Net commands. It was
suggested there to remove the Microsoft.VisualBasic import and use true .Net
commands to generate leaner, tighter code. As a best practice, my team
leader has dictated we elminate the Microsoft.VisualBasic import from all of
our code.
Nov 20 '05 #16
In article <c6************@ID-208219.news.uni-berlin.de>, Herfried K. Wagner [MVP] wrote:
* Tom Shelton <to*@mtogden.com> scripsit:
If Not IsNothing(input) Then

Especialy that IsNothing(input) that is real the one.

:-))

Cor


Huh? I'm not following...


'IsNothing' is part of 'Microsoft.VisualBasic' and the OP doesn't want
to use this namespace ;-).


Oh, yeah! Ok, then change it to:

If Not input Is Nothing ....

Sorry.
--
Tom Shelton [MVP]
Nov 20 '05 #17
John,

* "John Cobb" <jo*******@acxiom.com> scripsit:
I've removed the Microsoft.VisualBasic import from my VB.Net project and am
Are you ill?


LOL. Not that I know of.


;-)
At the Develop Mentor Architect Training event hosted by Microsoft in
the Dallas office this week the instructor was showing how some functions
like
these are wrapped by .Net to allow backwards compatibility with vb6 and if
you use
Partly I agree. Some of the methods in the Visual Basic .NET Runtime
Library internally base on methods of the .NET Framework, but most of
them are more than a "wrapper". For example, 'IsNumeric' is performing
much more operations than you may expect it to do.
ildasm to look at the intermediate language of your assembly you can see
where certain ones generate more IL than native .Net commands. It was
suggested there to remove the Microsoft.VisualBasic import and use true .Net
I would not do that.
commands to generate leaner, tighter code.
Tell me, what's "cleaner" than 'Strings.StrReverse'? I don't see
anything dirty there.
As a best practice, my team
leader has dictated we elminate the Microsoft.VisualBasic import
from all of our code.


Tell him that this is nonsense ;-).

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #18
Hi,

There are lots of silly suggestions around. That sounds like one of them to
me. IMO, of course.

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
Nov 20 '05 #19
Hi Herfried,

As far as I know are the connection classes also a wrappers, I do not
believe that it is wise to delete those classes as well from the library

(That is in my opinion the main reason why there is always that discussion
about dispose with that one).

Just my thought,

Cor
Nov 20 '05 #20
* "Cor Ligthert" <no**********@planet.nl> scripsit:
As far as I know are the connection classes also a wrappers, I do not
believe that it is wise to delete those classes as well from the library


ACK. Wrapper <> bad.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #21
When it comes right down to it, some people have a phobia about the
name of that namespace (the "basic" part).

The solutions is simple - change the namespace name to
"System.CoolMiscellaneous", and everyone will be happy - hundreds of
very useful methods (that are currently being re-coded en masse by
programmers with far less experience than the the original coders of
these methods at Microsoft).

Or, be consistent in your phobia, and switch to C#.

Nov 20 '05 #22
When it comes right down to it, some people have a phobia about the
name of that namespace (the "basic" part).

The solutions is simple - change the namespace name to
"System.CoolMiscellaneous", and everyone will be happy - hundreds of
very useful methods (that are currently being re-coded en masse by
programmers with far less experience than the the original coders of
these methods at Microsoft).

Or, be consistent in your phobia, and switch to C#.

Nov 20 '05 #23

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Vibha Tripathi | last post by:
Hi Folks, I put a Regular Expression question on this list a couple days ago. I would like to rephrase my question as below: In the Python re.sub(regex, replacement, subject)...
5
by: Dennis | last post by:
if you have the headers and main in below code snippet, the below ios::noreplace creates an error: error C2039: 'noreplace' : is not a member of 'basic_ios<char,struct std::char_traits<char> >'...
20
by: Paul D. Boyle | last post by:
Hi all, There was a recent thread in this group which talked about the shortcomings of fgets(). I decided to try my hand at writing a replacement for fgets() using fgetc() and realloc() to read...
0
by: Paul Hsieh | last post by:
"Paul D. Boyle" <boyle@laue.chem.ncsu.edu> wrote: > There was a recent thread in this group which talked about the > shortcomings of fgets(). I decided to try my hand at writing a > replacement...
9
by: Freejack | last post by:
Recently I've been spending some time googling around for ideas for an alloca() replacement that could function in a strict ANSI C environment. As we all know, alloca() is system/arch dependant. ...
3
by: Jeffrey D. Gordon | last post by:
I'm wanting to replace Field Values in an existing PDF, I've done this with PHP by doing a replace in the file. I've been able to read the file in a byte array in c# but all my attempts to...
32
by: chris.fairles | last post by:
Just want an opinion. I have an algorithm that needs to run as fast as possible, in fact. Its already too slow. I've done as much algorithmic changes as I can to reduce the amount of code, so now...
7
imrosie
by: imrosie | last post by:
Hello, I don't completely understand the working of these functions, but it's been suggested that these will give me what I need. I have a database that pulls in image files (stores the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.