Click here to Skip to main content
15,888,968 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Don't know what question should I really ask here so below is a sample line of code that I am having some trouble with.

I'm trying to print a static value for string that is inside the double quotations and a dynamic value for string after the first string.

Please help me. Thanks!

What I have tried:

variable = "Some string here " + variable.text
Posted
Updated 14-Sep-17 21:04pm

Try:
variable = "Some string here " & variable
Or:
variable.Text = "Some string here " & variable.Text
 
Share this answer
 
Comments
noob_noob 15-Sep-17 3:14am    
This works!! Thanks!
OriginalGriff 15-Sep-17 3:52am    
You're welcome!
Seems a strange thing to be doing, but I this this is what you're trying to do:-
variable = "Some string here " + variable
 
Share this answer
 
Instead of doing it in string, can you try StrinBuilder.

//Loop or your statement
{
StringBuilder sb = new StringBuilder();
if(sb.length==0)
{
sb.Append("Some string here");
}
sb.Append(variable);
}

you can do it in string also
 
Share this answer
 
I don't see problems with you approach, the following code
VB
Sub Main()
    Dim s As String
    Console.WriteLine("Please enter your name")

    s = Console.ReadLine()
    s = "Hello " + s
    Console.WriteLine(s)
  End Sub
works fine.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900