Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

James Robertson http://www.r0bertson.co.uk

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Setting a string variable with a mult-line text value

This example demonstrates how easy it is to copy and paste human-readable text from elsewhere and declare it as a string in your code.

   1  
   2  string = <<RUBY_RUBY_RUBY
   3    <mydoc>
   4      <someelement attribute="nanoo">Text, text, text</someelement>
   5    </mydoc>
   6  RUBY_RUBY_RUBY
   7  


Note: Remember to encase the text within a pair of strings, any string (the convention is to make it uppercase) and ensure it's not a reserved keyword, or a variable declared already.
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS