0

I've got a simple string problem I can't seem to fix.

The string itself contains things like "random" & random.next(1,3) & "random2" etc. The string registers all of this as a string and doesn't actually calculate random numbers.

Is there any way to fix this? I know that was confusing, so please ask questions.

Thank you,

Resentful

4
Contributors
8
Replies
9
Views
6 Years
Discussion Span
Last Post by Resentful
0

Will you be more specific? please. Do you have problems in **calculating** random numbers? What is meaning of "calculate random numbers."

0

The string holds various strings and methods, but it counts them all as string.

So "random" & random.next(1,3) & "random2" = "random" & random.next(1,3) & "random2"

Instead of random1random2

0

Correct me if I'm wrong.

Dim str as string=""
 Dim r As New Random
            
 str&="random" & r.Next(1, 3)
 str&="random2" & r.Next(1,3)
0

It's not that simple. I understand VB.Net pretty well.

Here is my actual code. Instead of using the variable or generating numbers, it put the actual code. All of this is kept inside a string. I need to make it function correctly.

"1=" & numbers.lines(count) & "&2=" & second.text & "&3=" & third.text & "&5=" & random.next(9,18) & "&6=yes"

So instead of it saying 1=1&2=second&3=third&5=12&6=yes

It says:

1=" & numbers.lines(count) & "&2=" & second.text & "&3=" & third.text & "&5=" & random.next(9,18) & "&6=yes

0

try this:
Dim testString As String = String.Format("1={0}&2={1}&3={2}&5={3}&6=yes", numbers.lines(count), Second.text, third.text, random.Next(9, 18))
Debug.writeline(testString)

0

I'm afraid you guys don't quite understand the situation.

The string is being parsed from a script made with another program. One program makes scripts, and the other one runs them.

When it parses a certain string, all of the information inside of it stays a string instead of actually doing anything.

0

How do the programs interface to "parse" this string? Your problem lies with in the issue of containing that first. Then you should handle the input as it parsed via a split command to associate the parts that are scripts and the others that are not. For us to understand better, we need a little more code than this.

Edited by zinnqu: n/a

0

I used some makeshift methods to complete it.

Thank you guys for your assistance. I know it was confusing.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.