473,394 Members | 1,658 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,394 software developers and data experts.

Is String() Function Gone?

TC
Visual Basic used to have a function called String(), which would create a
repeating character string. Is that gone in VB .NET?

-TC
Nov 20 '05 #1
7 5990
TC,

Take a look as string.PadLeft and string.PadRight

These two functions replace the old String() functions

Kirk Graves

"TC" <q@w.e> wrote in message
news:uC******************@news1.central.cox.net...
Visual Basic used to have a function called String(), which would create a
repeating character string. Is that gone in VB .NET?

-TC

Nov 20 '05 #2
Look For StringBuilder i think its called.
"TC" <q@w.e> wrote in message news:uC******************@news1.central.cox.net...
Visual Basic used to have a function called String(), which would create a
repeating character string. Is that gone in VB .NET?

-TC

Nov 20 '05 #3
Hi,

Yes the string function is gone. You can however create a new
string with repeating characters.

Dim strC As String

strC= new String("C",10) ' New string CCCCCCCCCC

Me.Text = strC

Ken

----------------

"TC" <q@w.e> wrote in message
news:uC******************@news1.central.cox.net...
Visual Basic used to have a function called String(), which would create a
repeating character string. Is that gone in VB .NET?

-TC

Nov 20 '05 #4
"TC" <q@w.e> schrieb
Visual Basic used to have a function called String(), which would
create a repeating character string. Is that gone in VB .NET?


s = new string("x"c, 20)
--
Armin

Nov 20 '05 #5
TC,
I would recommend Ken's example

Dim strC As String

strC= new String("C"c,10) ' New string CCCCCCCCCC

Me.Text = strC

Note if you are using Option Strict On (you are using Option Strict On
correct!), you will need to specify a Char literal as opposed to a String
Literal. A Char literal looks like a String literal only it has a lower case
c on the end.

"A"c is a char literal
"A" is a string literal.

There is also the StrDup function found in the Microsoft.VisualBasic.Strings
module that you can use to create the string.

strC = StrDup(10, "C"c)
strC = StrDup(10, "C")

Dim obj As Object = "C"
obj = StrDup(10, obj)

Which is overloaded for Char, String and Object, so its more forgiving with
Option Strict On. Note the Object overload returns an Object, however the
parameter still needs to contain a String or Char.

Hope this helps
Jay
"TC" <q@w.e> wrote in message
news:uC******************@news1.central.cox.net...
Visual Basic used to have a function called String(), which would create a
repeating character string. Is that gone in VB .NET?

-TC

Nov 20 '05 #6
"TC" <q@w.e> scripsit:
Visual Basic used to have a function called String(), which would create a
repeating character string. Is that gone in VB .NET?


The function has been renamed to 'StrDup'.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #7
TC
Thank you all for the replies. I am now much more knowledgeable.

-TC
"TC" <q@w.e> wrote in message
news:uC******************@news1.central.cox.net...
Visual Basic used to have a function called String(), which would create a
repeating character string. Is that gone in VB .NET?

-TC

Nov 20 '05 #8

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

Similar topics

5
by: Alfonso Morra | last post by:
Hi, What is the recomended way of returning an STL container (e.g. std::string, std::vector etc fom a function? Is it by simply returning a local variable? (I doubt it) std::string...
18
by: intercom5 | last post by:
I'm writing a program in C, and thus have to use C strings. The problem that I am having is I don't know how to reallocate the space for a C string outside the scope of that string. For example:...
1
by: Jeffrey B. Holtz | last post by:
I'm trying to get the Name of the USB device pluged in from the RegisterDeviceNotification that I've used P/Invoke to marshal. I have seen a similar posting on the VisualBasic newgroups but I do...
2
by: Raed Sawalha | last post by:
i have an aspx page in the code behind i have in aspx.cs public string sPath = "C:\\Public\\User\\Other"; is aspx when I tried to get the string the slahes is gone i tried to alert the string...
0
by: KarenS | last post by:
I am using Microsoft Developer Environment 2003 Version 7.1.3088 and .NET Framework version 1.1.4322 SP1. From my web-service I get one row of data and return it to my client. From my client I...
2
by: Kevin Blount | last post by:
I have a string of HTML (used for a specific purpose) that I'd like to use somewhere else but as plain text. Rather than introduce a specifically created plain text version I'd like to strip the...
8
by: alternativa | last post by:
Hi, how to write a function that would return a string? I've tried something like this: char enterstring(void) { char somestring; printf("\tstring: "); fgets(somestring, sizeof somestring,...
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
2
by: ptq2238 | last post by:
Hi, I've been experimenting some more with strings, I've written some code where I want to test to see if a certain character char_a is in the testlist string. Simple enough. The problem is when...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
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...
0
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...
0
jinu1996
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...
0
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 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.