Substring/Top and tail: Difference between revisions
Content added Content deleted
Line 1,216: | Line 1,216: | ||
string s_first_last = s[1:s.length - 1]; |
string s_first_last = s[1:s.length - 1]; |
||
</lang> |
</lang> |
||
=={{header|VBScript}}== |
|||
<lang VBScript>Function TopNTail(s,mode) |
|||
Select Case mode |
|||
Case "top" |
|||
TopNTail = Mid(s,2,Len(s)-1) |
|||
Case "tail" |
|||
TopNTail = Mid(s,1,Len(s)-1) |
|||
Case "both" |
|||
TopNTail = Mid(s,2,Len(s)-2) |
|||
End Select |
|||
End Function |
|||
WScript.Echo "Top: UPRAISERS = " & TopNTail("UPRAISERS","top") |
|||
WScript.Echo "Tail: UPRAISERS = " & TopNTail("UPRAISERS","tail") |
|||
WScript.Echo "Both: UPRAISERS = " & TopNTail("UPRAISERS","both")</lang> |
|||
{{out}} |
|||
<pre>Top: UPRAISERS = PRAISERS |
|||
Tail: UPRAISERS = UPRAISER |
|||
Both: UPRAISERS = PRAISER</pre> |
|||
=={{header|XPL0}}== |
=={{header|XPL0}}== |