Filemaker: различия между версиями

Материал из Wiki Mininuniver
Перейти к навигацииПерейти к поиску
(Новая: 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...)
 
Строка 1: Строка 1:
Needle - This parameter represents the substring for which we desire to research.
+
Situation( PatternCount( Haystack  Needle ) &gt
  
Alternative - This retains the string that will substitute the substring in Needle.
+
  Replace( Haystack  Placement( Haystack  Needle  1  one )  Duration( Needle )  Substitute )
 
 
Haystack - This parameter holds the complete string to search: the proverbial Haystack in which to discover and change the Needle, if you will.
 
 
 
Operate Human body:
 
 
 
Scenario( PatternCount( Haystack Needle ) &gt
 
 
 
Substitute( Haystack  Posture( Haystack  Needle  1  1 )  Duration( Needle )  Substitute )
 
  
 
  Haystack)
 
  Haystack)
  
   Making use of the designed-in Situation operate (due to the fact there are only two cases, the If operate could be utilised listed here as well), we take a look at for the existence of Needle within Haystack with the built-in PatternCount purpose:
+
   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 )&gt0  For the accurate scenario, we print the outcomes of the developed-in Swap(textstartnumberOfCharactersreplacementText) operate.
+
PatternCount ( Haystack  Needle )&gt0  For the genuine situation, we print the effects of the constructed-in Substitute(textstartnumberOfCharactersreplacementText) perform.
  
Exchange ( Haystack  Placement ( Haystack  Needle  one one Length ( Needle )  Alternative )  The replacement within Haystack starts off at the position of the very first occasion of Needle and extends the number of people of Needle and is replaced by Alternative.
+
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 fake or default case, we simply print Haystack considering that there is no Needle to replace.
+
For the false or default scenario, we only print Haystack given that there is no Needle to exchange.
  
  International Lookup and Replace Purpose  
+
  Global Search and Replace Purpose  
  
Functionality Identify: String Swap
+
Operate Title: String Substitute
  
 
Parameters:
 
Parameters:
  
Needle - This parameter represents the substring for which we want to research.
+
Needle - This parameter signifies the substring for which we want to search.
  
Alternative - This holds the string that will substitute the substring in Needle.
+
Substitute - This retains the string that will substitute the substring in Needle.
  
Haystack - This parameter retains the overall string to look for: the proverbial Haystack in which to come across and swap the Needle, if you will.
+
Haystack - This parameter holds the complete string to research: the proverbial Haystack in which to locate and substitute the Needle, if you will.
  
Perform Human body:
+
Functionality Entire body:
  
 
If( PatternCount( Haystack  Needle ) &gt   
 
If( PatternCount( Haystack  Needle ) &gt   
  
Allow( pos = Position( Haystack  Needle  one  one ) + Length( Needle )  
+
Let( pos = Situation( Haystack  Needle  one  1 ) + Duration( Needle )  
  
Enable(
+
Permit(
  
[  HaystackBegin = Circumstance( pos &gt  Left( Haystack  pos - 1 )  "" )  
+
[  HaystackBegin = Situation( pos &gt  Remaining( Haystack  pos - one )  "" )  
  
HaystackEnd = Center ( Haystack  pos  Length( Haystack ) - pos + 1 )
+
HaystackEnd = Center ( Haystack  pos  Size( Haystack ) - pos + 1 )
  
 
]
 
]
  
String Substitute( Needle  Replacement HaystackBegin ) &amp String Replace All( Needle  Substitute  HaystackEnd )
+
String Replace( Needle  Alternative HaystackBegin ) &amp String Replace All( Needle  Substitute  HaystackEnd )
  
 
)
 
)
Строка 53: Строка 45:
 
)
 
)
  
  Haystack)  Our foundation situation in this article is a Haystack with circumstances of Needle. Below we merely output the Haystack.
+
  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 ) &gt  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:
  
For a defining issue, when Haystack has additional than  occasions of Needle (it can by no means have a detrimental quantity of instances, of program), we change the initial instance and simply call this function recursively with the remaining Haystack. With every contact, there will be a single a lot less Needle in the Haystack, until eventually the base problem is reached where  Needles exist in the Haystack.
 
  
Making use of the created-in If operate, we do a test for a non-foundation condition which is a Haystack with one or more occasion of Needle.
+
pos = Situation( Haystack  Needle  one  one ) + Size( Needle ) - The character posture inside Haystack instantly next the very first occasion of Needle.
 +
HaystackBegin = Scenario( pos &gt  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(&amp) with the recursive contact to String Change All with the remaining Haystack.
  
PatternCount( Haystack Needle ) &gt  The motive we don't check specifically for the foundation condition (i.e.PatternCount ( Haystack Needle ) = ), is that in some instances, such as when Haystack is vacant, the PatternCount perform may well return an undefined price, which is neither  nor better than , but should final result in a base condition return.
+
String Swap( Needle  Substitute HaystackBegin ) &amp String Substitute All( Needle  Alternative HaystackEnd ) Lastly, when the PatternCount affliction is false, we simply print Haystack.
  
If the affliction is accurate, there are Needles in the Haystack, so we set these variables:
 
  
  
pos = Position( Haystack  Needle  1  one ) + Duration( Needle ) - The character place inside of Haystack quickly subsequent the 1st instance of Needle.
+
[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]
HaystackBegin = Scenario( pos &gt  Left( Haystack pos - 1 )  "" ) - The content of the Haystack string up to position pos. This string will consist of precisely 1 occasion of Needle
 
HaystackEnd = Middle( Haystack  pos  Size(Haystack) - pos + one ) - The remaining material of Haystack made up of one less occasion of Needle. [http://www.iccup.com/dota/content/blogs/FM0-304_-_Increase_Your_Filemaker_ten_Experti.html filemaker], [http://blog.bitcomet.com/post/3534028 hosting], [http://hook03porter.wordpress.com/2013/04/13/filemaker-2/ FileMaker Pro Custom made Operate - World wide Look for and Swap]
 

Версия 18:56, 13 апреля 2013

Situation( PatternCount( Haystack Needle ) &gt

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 )&gt0 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 ) &gt

Let( pos = Situation( Haystack Needle one 1 ) + Duration( Needle )

Permit(

[ HaystackBegin = Situation( pos &gt Remaining( Haystack pos - one ) "" )

HaystackEnd = Center ( Haystack pos Size( Haystack ) - pos + 1 )

]

String Replace( Needle Alternative HaystackBegin ) &amp 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 ) &gt 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 &gt   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(&amp) with the recursive contact to String Change All with the remaining Haystack.

String Swap( Needle Substitute HaystackBegin ) &amp 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