|
-
Jul 4th, 2006, 02:56 PM
#1
Thread Starter
Junior Member
Print <<EOF
does C# has function like perl/php
print <<EOF;
Somthing $a
Line 2
EOF
print multi-line ?
-
Jul 4th, 2006, 04:20 PM
#2
Re: Print <<EOF
Given that many of us will never have used perl or php, you're limiting who can answer by basically providing code in one of those languages and asking whether C# can do the same. I don't know what that code does exactly so I don't know if C# can do it. Perhaps if you were to describe what it is that you're trying to do.
-
Jul 4th, 2006, 07:50 PM
#3
-
Jul 5th, 2006, 01:24 AM
#4
Re: Print <<EOF
If you wrap your string in double quotes and prepend it with the @ symbol, it can span multiple lines, which is similar to the perl construct you are describing.
Code:
Console.WriteLine(
@"hello
world
line 3"
);
To place a variable in the string, you place {0}, {1}, {2} where you want the variable to appear, and then add your variables after the constant string:
Code:
Console.WriteLine("{0} {2} {1}", "hello", 3, "world");
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
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
|