Substring/Top and tail: Difference between revisions
Content added Content deleted
(Added Haskell version.) |
(added c#) |
||
Line 100: | Line 100: | ||
ANSI C provides little functionality for text manipulation outside of string.h. While a number of libraries for this purpose have been written, this example uses only ANSI C. |
ANSI C provides little functionality for text manipulation outside of string.h. While a number of libraries for this purpose have been written, this example uses only ANSI C. |
||
=={{header|C sharp}}== |
|||
<lang C sharp> |
|||
class Program |
|||
{ |
|||
static void Main(string[] args) |
|||
{ |
|||
string testString = "test"; |
|||
Console.WriteLine(testString.Substring(1)); |
|||
Console.WriteLine(testString.Substring(0, testString.Length - 1)); |
|||
Console.WriteLine(testString.Substring(1, testString.Length - 2)); |
|||
} |
|||
} |
|||
</lang> |
|||
Result: |
|||
<pre>est |
|||
tes |
|||
es</pre> |
|||
=={{header|D}}== |
=={{header|D}}== |