splice
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | splice [2007/03/02 02:32] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | # $EPIC: splice.txt, | ||
+ | ======Synopsis: | ||
+ | $__splice__(< | ||
+ | |||
+ | ======Technical: | ||
+ | * If the < | ||
+ | * If the < | ||
+ | * If the < | ||
+ | * If the < | ||
+ | * < | ||
+ | * < | ||
+ | * If < | ||
+ | * If < | ||
+ | * It is not easy to explain how this function works using bullet points. There are four values created using $< | ||
+ | * Let < | ||
+ | * If < | ||
+ | * If <index + count> is greater than <L> \\ Part 1 -- Words 0 through (< | ||
+ | * If <index + count> is less than <L> \\ Part 1 -- Words 0 through (< | ||
+ | * The new value of $< | ||
+ | * The return value of the function is <part 2> | ||
+ | * Remember that <word list> is a list of [[what is a word|words]]. | ||
+ | |||
+ | ======Practical: | ||
+ | Whew. The above technical description is a mouthful and is very confusing. | ||
+ | In practical terms, what this function does is " | ||
+ | removing some words from the variable and pasting in other words in their | ||
+ | place. | ||
+ | from zero, of course), and put < | ||
+ | end of a string by using an unreasonably large value of < | ||
+ | start counting from the end of the string by using a negative < | ||
+ | The return value of the function is the text that was removed from the | ||
+ | variable. | ||
+ | |||
+ | When you get down to the bottom line, you can use this function to change | ||
+ | one or more words in a function without having to rewrite the whole thing. | ||
+ | If you have a word index returned by the matching functions, you could use | ||
+ | it to search-and-replace words in a variable. | ||
+ | |||
+ | ======Returns: | ||
+ | The < | ||
+ | variable $< | ||
+ | < | ||
+ | If any error occurs, $< | ||
+ | |||
+ | ======Examples: | ||
+ | < | ||
+ | @ foo = [one two three four five] | ||
+ | $splice(foo 1 3 foo bar blah) | ||
+ | $splice(foo 0 2) returns "one foo" | ||
+ | $splice(foo 2 1) returns " | ||
+ | echo $foo shows "bar blah", end result | ||
+ | </ | ||
splice.txt · Last modified: 2007/03/02 02:32 by 127.0.0.1