string-manipulation functions

J

John A Grandy

what are the preferred VB.NET analogues for IsNumeric() and Len() and CInt()
& similar string-manipulation functions in VB6
 
J

Justin Weinberg

len - string.length
cint - ctype("x", int32)

There isn't an analogous IsNumeric to my knowledge (but IsNumeric is still
there! Go VB!). A C# programmer would try int32.Parse or the appropriate
type and take action on an exception.
 
C

Cor

John,
what are the preferred VB.NET analogues for IsNumeric() and Len() and CInt()
& similar string-manipulation functions in VB6

They still exist as a major part from Vb.net, this question is often
discussed in this newsgroup.
So you can search for those threads (keywords like mid or len)
Beside this you can use much more methodes.
Look for instance for the string members and the regex, but there are a lot
more.

An advise often given in this newsgroup is, take that what fits you the
most, the result of the endcode will not be a big difference.

I hope this helps a little bit.
Cor

Ps. not all functions still exist.
 
W

William Ryan

I totally agree with Cor, but if you want to use them..

Type in Microsoft.VisualBasic and when you hit the next period, you'll see
them all there in intellisense.

As a suggestion though, look through the string and regex classes, there is
a lot of backward compatibility in VB.NET for VB6, but that doesn't
necessarily mean you should use it.

HTH,

Bill
 
L

Lucas Tam

what are the preferred VB.NET analogues for IsNumeric() and Len() and
CInt() & similar string-manipulation functions in VB6


CInt, IsNumeric, and Len are still there. However, for Length, you can go
String.Length() as well.
 
H

Herfried K. Wagner [MVP]

Hello,

Justin Weinberg said:
len - string.length
ACK.

cint - ctype("x", int32)

No... That's (IMO) really bad. I would prefer 'Integer.Parse' or
'Convert.ToInt32'.
There isn't an analogous IsNumeric to my knowledge (but
IsNumeric is still there! Go VB!). A C# programmer would
try int32.Parse or the appropriate type and take action on an
exception.

You can use 'Double.TryParse' instead of 'IsNumeric'.
 
H

Herfried K. Wagner [MVP]

Hello,

William Ryan said:
As a suggestion though, look through the string and
regex classes, there is a lot of backward compatibility
in VB.NET for VB6, but that doesn't necessarily mean
you should use it.

Examples for "backward compatibility" stuff?
 
H

Herfried K. Wagner [MVP]

Hello,

John A Grandy said:
what are the preferred VB.NET analogues for
IsNumeric() and Len() and CInt() & similar string-
manipulation functions in VB6

If you understand what "BASIC" means, still use these functions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top