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

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

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

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)

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

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)

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.

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 5 Years Ago by zinnqu: n/a

I used some makeshift methods to complete it.

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

This article has been dead for over six months. Start a new discussion instead.