|
-
July 19th, 2001, 03:30 AM
#1
VB equivalent for sprintf
Hi there,
I'm looking for a VB method of using placeholders in a string so that dynamic text can be substituted in. For example, in C++, one could do:
char* buffer;
sprintf( buffer, "The quick brown %s jumped over the lazy dog.", "fox");
And then the buffer would contain "The quick brown fox jumped over the lazy dog."
Basically, I want to load text from a data file, which contains some sort of placeholder like this, so that I can easily insert any dynamic text into the string without having to fiddle about with Split or ReplaceWord or things like that if I can help it.
Thanks!
Marion
-
July 19th, 2001, 03:49 AM
#2
Re: VB equivalent for sprintf
in vb, it's much simpler.
buffer = The quick brown " & cstr(fox) & jumped over the lazy dog."
where fox is the string variable.
Format statement is helpful too.
HTH
cksiow
http://vblib.virtualave.net - share our codes
-
July 19th, 2001, 03:52 AM
#3
Re: VB equivalent for sprintf
The trouble is, I want to load a single string from a file and insert the dynamic text into various bits of it. I don't want three or four small strings that I'll have to & together like that.
Is there any other way?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|