Difference between revisions of "Talk:S2 Cookbook: Strings"
From Dreamwidth Notes
Foxfirefey (Talk | contribs) |
|||
Line 21: | Line 21: | ||
: Oh, and while I'm here talking to myself, might be a good idea to add a really basic "Concatenating two strings together" section near the beginning of this category, just to illustrate the use of the + sign in the context of strings. --[[User:Murklins|Murklins]] 06:30, 2 July 2010 (UTC) | : Oh, and while I'm here talking to myself, might be a good idea to add a really basic "Concatenating two strings together" section near the beginning of this category, just to illustrate the use of the + sign in the context of strings. --[[User:Murklins|Murklins]] 06:30, 2 July 2010 (UTC) | ||
+ | |||
+ | : I totally agree with all of the above! --[[User:Foxfirefey|Foxfirefey]] 21:32, 4 July 2010 (UTC) |
Revision as of 21:32, 4 July 2010
I think the "Repeating a string" example might be kind of confusing because it talks about "replacing" one string with another, but no actual replacement is done, and string replacement is actually covered by the next code sample. I'm thinking something more like this:
var string sentence = "I am a quick brown fox."; var int length = $sentence->length(); var string underline = "-"; # Print out the sentence. """<p style="font-family: courier;">$sentence"""; # Underline the sentence using the $underline string. "<br />" + $underline->repeat( $length ) + "</p>";
Will print out:
I am a quick brown fox. -----------------------
--Murklins 05:53, 2 July 2010 (UTC)
- Oh, and while I'm here talking to myself, might be a good idea to add a really basic "Concatenating two strings together" section near the beginning of this category, just to illustrate the use of the + sign in the context of strings. --Murklins 06:30, 2 July 2010 (UTC)
- I totally agree with all of the above! --Foxfirefey 21:32, 4 July 2010 (UTC)