|
-
June 11th, 2008, 12:34 PM
#1
[RESOLVED] ¿Is possible?
Code:
MyString = join({String1 , String2 , String3 , String4, String5},"")
(it does not work)
_
-
June 11th, 2008, 01:50 PM
#2
Re: ¿Is possible?
Why whould you think that it works ???
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
-
June 11th, 2008, 02:14 PM
#3
Re: ¿Is possible?
 Originally Posted by GremlinSA
Why whould you think that it works ???
it needs to be:
Code:
MyString = join(ArrayVariable,"")
and I give the array
Code:
{String1 , String2 , String3 , String4, String5}
This works:
Code:
ArrayVariable = {String1 , String2 , String3 , String4, String5}
MyString = join(ArrayVariable ,"")
I have lines like:
Code:
MyString = String1 & String2 & String3 & String4 & String5
When two of the strings String# are long, that code is very slow. I have lines with a short number of long strings, and a large number of short strings. The time is proportional to the number of small strings, because for each short string, all the long lines are copied again.
String.Join() works much more faster, but I don't like dividing the code in many lines.
_
-
June 12th, 2008, 01:15 AM
#4
-
June 12th, 2008, 08:05 AM
#5
Re: ¿Is possible?
 Originally Posted by HanneSThEGreaT
Yes, I had read it. (Thanks anyway for caring ). I fact I used String.Concat(data, data, data). Still I would like to know if there are a way, to use a string constant defined in place, in the way I have post.
For example, is valid to write:
Code:
Dim MyArray as String() = {data, data, data}
but is invalid this line:
Code:
String.Join("", {data, data, data} )
maybe there is a way to do it that way, like:
Code:
String.Join("", New String()={data, data, data} )
'(it does not work)
Just for curiosity.
_
-
June 12th, 2008, 08:37 AM
#6
Re: ¿Is possible?
 Originally Posted by Marraco
<snip>
Code:
String.Join("", New String()={data, data, data} )
'(it does not work)
Just for curiosity.
_
Remove the =
-
June 12th, 2008, 08:45 AM
#7
Re: ¿Is possible?
 Originally Posted by Alsvha
Remove the =
Perfect. That is.
PD:I wonder why Microsoft had made it different that in the Dim line.
_
-
June 12th, 2008, 09:23 AM
#8
Re: ¿Is possible?
 Originally Posted by Marraco
PD:I wonder why Microsoft had made it different that in the Dim line.
_
With the declaration, if you are going to declare an array like that, you need to give it values, so that the array can be initialised.
With the Join statement, the Join function expects an array of values, that is why using an already existing array works in there, else, like with your code, you created an array of values on the fly ( inside the Join method ) - you are not assinging those values to a variable or array ( as you did with the declaration ), your just supplying values to the Join method to work properly.
Does that make sense ¿
PS, I only now see what you wanted to achieve, sorry
-
June 12th, 2008, 11:38 AM
#9
Re: ¿Is possible?
 Originally Posted by HanneSThEGreaT
With the declaration, if you are going to declare an array like that, you need to give it values, so that the array can be initialised.
With the Join statement, the Join function expects an array of values, that is why using an already existing array works in there, else, like with your code, you created an array of values on the fly ( inside the Join method ) - you are not assinging those values to a variable or array ( as you did with the declaration ), your just supplying values to the Join method to work properly.
Does that make sense ¿
I was whining why "=" is not required in:
Code:
Join(New String() {data,data,data},"") 'Is not Join(New String() = {data,data,data},"")
When is required (as is reasonable) in:
Code:
Dim MyArray As String() = {data,data,data}
 Originally Posted by HanneSThEGreaT
PS, I only now see what you wanted to achieve, sorry 
Don't sorry. You give help. Thanks.
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
|