Filemaker: различия между версиями
Hoe83yarn (обсуждение | вклад) (Новая: Needle - This parameter represents the substring for which we desire to research. Alternative - This retains the string that will substitute the substring in Needle. Haystack - This pa...) |
Hoe83yarn (обсуждение | вклад) |
||
| Строка 1: | Строка 1: | ||
| − | Needle | + | Situation( PatternCount( Haystack Needle ) > |
| − | + | Replace( Haystack Placement( Haystack Needle 1 one ) Duration( Needle ) Substitute ) | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Haystack) | Haystack) | ||
| − | + | Using the developed-in Situation function (given that there are only two situations, the If perform could be utilized here as well), we examination for the existence of Needle in Haystack with the designed-in PatternCount operate: | |
| − | PatternCount ( Haystack Needle )>0 For the | + | PatternCount ( Haystack Needle )>0 For the genuine situation, we print the effects of the constructed-in Substitute(textstartnumberOfCharactersreplacementText) perform. |
| − | + | Change ( Haystack Position ( Haystack Needle 1 1 ) Duration ( Needle ) Alternative ) The alternative within just Haystack starts off at the position of the initial instance of Needle and extends the variety of people of Needle and is changed by Substitute. | |
| − | For the | + | For the false or default scenario, we only print Haystack given that there is no Needle to exchange. |
| − | + | Global Search and Replace Purpose | |
| − | + | Operate Title: String Substitute | |
Parameters: | Parameters: | ||
| − | Needle - This parameter | + | Needle - This parameter signifies the substring for which we want to search. |
| − | + | Substitute - This retains the string that will substitute the substring in Needle. | |
| − | Haystack - This parameter | + | Haystack - This parameter holds the complete string to research: the proverbial Haystack in which to locate and substitute the Needle, if you will. |
| − | + | Functionality Entire body: | |
If( PatternCount( Haystack Needle ) > | If( PatternCount( Haystack Needle ) > | ||
| − | + | Let( pos = Situation( Haystack Needle one 1 ) + Duration( Needle ) | |
| − | + | Permit( | |
| − | [ HaystackBegin = | + | [ HaystackBegin = Situation( pos > Remaining( Haystack pos - one ) "" ) |
| − | HaystackEnd = Center ( Haystack pos | + | HaystackEnd = Center ( Haystack pos Size( Haystack ) - pos + 1 ) |
] | ] | ||
| − | String | + | String Replace( Needle Alternative HaystackBegin ) & String Replace All( Needle Substitute HaystackEnd ) |
) | ) | ||
| Строка 53: | Строка 45: | ||
) | ) | ||
| − | Haystack) Our foundation situation in | + | Haystack) Our foundation condition listed here is a Haystack with situations of Needle. Right here we only output the Haystack. |
| + | |||
| + | For a defining issue, when Haystack has a lot more than circumstances of Needle (it can never ever have a adverse number of circumstances, of course), we replace the first instance and contact this purpose recursively with the remaining Haystack. With each call, there will be 1 significantly less Needle in the Haystack, till the foundation situation is achieved where Needles exist in the Haystack. | ||
| + | |||
| + | Utilizing the constructed-in If function, we do a take a look at for a non-foundation affliction which is a Haystack with one or additional occasion of Needle. | ||
| + | |||
| + | PatternCount( Haystack Needle ) > The cause we really don't check immediately for the base issue (i.e.PatternCount ( Haystack Needle ) = ), is that in some instances, these as when Haystack is vacant, the PatternCount perform could return an undefined worth, which is neither nor greater than , but need to consequence in a base issue return. | ||
| + | |||
| + | If the issue is true, there are Needles in the Haystack, so we set these variables: | ||
| − | |||
| − | + | pos = Situation( Haystack Needle one one ) + Size( Needle ) - The character posture inside Haystack instantly next the very first occasion of Needle. | |
| + | HaystackBegin = Scenario( pos > Still left( Haystack pos - 1 ) "" ) - The articles of the Haystack string up to posture pos. This string will incorporate exactly one instance of Needle | ||
| + | HaystackEnd = Center( Haystack pos Size(Haystack) - pos + 1 ) - The remaining content of Haystack that contains one particular a lot less instance of Needle. | ||
| + | Then, we print the result of HaystackBegin with its solitary occasion of Needle changed and concatenated(&) with the recursive contact to String Change All with the remaining Haystack. | ||
| − | + | String Swap( Needle Substitute HaystackBegin ) & String Substitute All( Needle Alternative HaystackEnd ) Lastly, when the PatternCount affliction is false, we simply print Haystack. | |
| − | |||
| − | + | [http://jamie-media.fanzoom.net/read_blog// hosting], [http://community.babycenter.com/journal/hoe65kidney/9987130/fm0-304_-_enhance_your_filemaker_10_expertise FM0-304 - Increase Your Filemaker 10 Abilities!], [http://sitnex.net/read_blog/173511/filemaker filemaker] | |
| − | |||
| − | |||
Версия 18:56, 13 апреля 2013
Situation( PatternCount( Haystack Needle ) >
Replace( Haystack Placement( Haystack Needle 1 one ) Duration( Needle ) Substitute )
Haystack)
Using the developed-in Situation function (given that there are only two situations, the If perform could be utilized here as well), we examination for the existence of Needle in Haystack with the designed-in PatternCount operate:
PatternCount ( Haystack Needle )>0 For the genuine situation, we print the effects of the constructed-in Substitute(textstartnumberOfCharactersreplacementText) perform.
Change ( Haystack Position ( Haystack Needle 1 1 ) Duration ( Needle ) Alternative ) The alternative within just Haystack starts off at the position of the initial instance of Needle and extends the variety of people of Needle and is changed by Substitute.
For the false or default scenario, we only print Haystack given that there is no Needle to exchange.
Global Search and Replace Purpose
Operate Title: String Substitute
Parameters:
Needle - This parameter signifies the substring for which we want to search.
Substitute - This retains the string that will substitute the substring in Needle.
Haystack - This parameter holds the complete string to research: the proverbial Haystack in which to locate and substitute the Needle, if you will.
Functionality Entire body:
If( PatternCount( Haystack Needle ) >
Let( pos = Situation( Haystack Needle one 1 ) + Duration( Needle )
Permit(
[ HaystackBegin = Situation( pos > Remaining( Haystack pos - one ) "" )
HaystackEnd = Center ( Haystack pos Size( Haystack ) - pos + 1 )
]
String Replace( Needle Alternative HaystackBegin ) & String Replace All( Needle Substitute HaystackEnd )
)
)
Haystack) Our foundation condition listed here is a Haystack with situations of Needle. Right here we only output the Haystack.
For a defining issue, when Haystack has a lot more than circumstances of Needle (it can never ever have a adverse number of circumstances, of course), we replace the first instance and contact this purpose recursively with the remaining Haystack. With each call, there will be 1 significantly less Needle in the Haystack, till the foundation situation is achieved where Needles exist in the Haystack.
Utilizing the constructed-in If function, we do a take a look at for a non-foundation affliction which is a Haystack with one or additional occasion of Needle.
PatternCount( Haystack Needle ) > The cause we really don't check immediately for the base issue (i.e.PatternCount ( Haystack Needle ) = ), is that in some instances, these as when Haystack is vacant, the PatternCount perform could return an undefined worth, which is neither nor greater than , but need to consequence in a base issue return.
If the issue is true, there are Needles in the Haystack, so we set these variables:
pos = Situation( Haystack Needle one one ) + Size( Needle ) - The character posture inside Haystack instantly next the very first occasion of Needle. HaystackBegin = Scenario( pos > Still left( Haystack pos - 1 ) "" ) - The articles of the Haystack string up to posture pos. This string will incorporate exactly one instance of Needle HaystackEnd = Center( Haystack pos Size(Haystack) - pos + 1 ) - The remaining content of Haystack that contains one particular a lot less instance of Needle. Then, we print the result of HaystackBegin with its solitary occasion of Needle changed and concatenated(&) with the recursive contact to String Change All with the remaining Haystack.
String Swap( Needle Substitute HaystackBegin ) & String Substitute All( Needle Alternative HaystackEnd ) Lastly, when the PatternCount affliction is false, we simply print Haystack.
hosting, FM0-304 - Increase Your Filemaker 10 Abilities!, filemaker