strins - Returns string B inserted into string A at position X.
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6384 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -152,6 +152,13 @@ docexample [if (strstr "Hello world!" Hello) [echo found Hello in Hello world!]
|
||||
docident [strlen] [Returns the length (in characters, including whitespace) of string S.];
|
||||
docargument [S] [The string to check.] [] [0];
|
||||
docexample [echo (strlen "Hello world!")] [output: 12];
|
||||
docident [strins] [Returns string B inserted into string A at position X.];
|
||||
docargument [A] [the original string] [] [0];
|
||||
docargument [B] [the string to insert into the original] [] [0];
|
||||
docargument [P] [the position at which to insert string B into string A] [] [0];
|
||||
docexample [echo (strins "Hello world" " cruel" 5)] [Output: Hello cruel world];
|
||||
docexample [tmp = "Hello world"; echo (strins $tmp " cruel" (strlen $tmp))] [Output: -1];
|
||||
docremark [];
|
||||
docident [substr] [Copies a substring out of the original];
|
||||
docargument [S] [The original string.] [] [0];
|
||||
docargument [A] [The starting position.] [] [0];
|
||||
|
||||
@@ -419,6 +419,19 @@ storesets = [
|
||||
]
|
||||
]
|
||||
|
||||
// strins - Inserts a string into another string, at position x.
|
||||
strins = [
|
||||
if (> $numargs 2) [
|
||||
if (&& (> $arg3 -1) (< $arg3 (strlen $arg1))) [
|
||||
tmp_output = ""
|
||||
loop sil (strlen $arg1) [
|
||||
if (= $sil $arg3) [ tmp_output = (concatword $tmp_output $arg2 (substr $arg1 $sil 1)) ] [ tmp_output = (concatword $tmp_output (substr $arg1 $sil 1)) ]
|
||||
]
|
||||
result $tmp_output
|
||||
] [ result -1 ]
|
||||
]
|
||||
]
|
||||
|
||||
// cleanshot - Take a "clean" screenshot with no HUD items.
|
||||
cs_sets = "clockdisplay crosshairsize hidecompass hideconsole hidectfhud hidedamageindicator hidehudequipment hidehudmsgs hideradar hidespecthud hideteam hidevote hudgun spechudgun showstats"
|
||||
cs_newsets = "0 0 1 1 1 1 1 1 1 1 1 1 0 0 0"
|
||||
|
||||
Reference in New Issue
Block a user