1 / 10

~ Lightning Talk ~ Here Document

~ Lightning Talk ~ Here Document. 楽しいアプリ制作の会 #1 TWorks. 自己紹介. TWorks 以 下 略 !. What is “ Here Document ” ??. カタカナで「ヒア(ヒヤ?)ドキュメント」 複数行の文字列を、変数に代入したりできる 便利な機能 たとえば・・・ > 長いSQL文を書くとき > システムが送るメールの文章を書くとき など. C#. string str = @ ” 文字列の前に @ マークを 付けるとヒアドキュメントみたくなります ” ;

shamus
Download Presentation

~ Lightning Talk ~ Here Document

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ~Lightning Talk~Here Document 楽しいアプリ制作の会 #1 TWorks

  2. 自己紹介 • TWorks 以 下 略 !

  3. What is “Here Document”?? • カタカナで「ヒア(ヒヤ?)ドキュメント」 • 複数行の文字列を、変数に代入したりできる便利な機能 • たとえば・・・> 長いSQL文を書くとき> システムが送るメールの文章を書くときなど

  4. C# string str = @”文字列の前に@マークを 付けるとヒアドキュメントみたくなります”; System.Console.WriteLine( str ); 文字列の前に@マークを(改行) 付けるとヒアドキュメントみたくなります

  5. Perl print << ”EOT”; Perlは終端識別子を”で括ると変数展開され ’で括ると変数展開されません  EOT Perlは終端識別子を”で括ると変数展開され(改行) ’で括ると変数展開されません

  6. PHP <?php print <<<EOT PHPのヒアドキュメントは < が3つですよ~ 終端識別子の後ろはセミコロンが要ります EOT; ?> PHPのヒアドキュメントは < が3つですよ~ (改行) 終端識別子の後ろはセミコロンが要ります

  7. Ruby print <<EOT Rubyのヒアドキュメントは << と終端識別子の間にスペースを入れちゃダメ EOT Rubyのヒアドキュメントは(改行) << と終端識別子の間にスペースを入れちゃダメ

  8. JavaScript 言語仕様でヒアドキュメントが無いようです。 ・・・がそれを作った人が居るようです! ■[JavaScript] JavaScriptでヒアドキュメントを使うライブラリを作った http://d.hatena.ne.jp/koseki2/20080112/jsheredoc var str =<<EOT 複数行の文字列です。 下の行でおわりです。 EOT

  9. Java Javaもヒアドキュメントが言語仕様的に ないみたいですね・・・ しかも代替策もないようです orz 見つけたら、また紹介したいと思います。

  10. ご静聴 ありがとうございました

More Related