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

Материал из Wiki Mininuniver
Перейти к навигацииПерейти к поиску
 
(не показаны 4 промежуточные версии этого же участника)
Строка 1: Строка 1:
Situation( PatternCount( Haystack  Needle ) &gt
+
Needle - This parameter signifies the substring for which we wish to search.
  
  Replace( Haystack  Placement( Haystack  Needle  1  one Duration( Needle )  Substitute )
+
Alternative - This holds the string that will replace the substring in Needle.
 +
 
 +
Haystack - This parameter holds the entire string to search: the proverbial Haystack in which to find and substitute the Needle, if you will.
 +
 
 +
Function Human body:
 +
 
 +
Scenario( PatternCount( Haystack Needle ) &gt
 +
 
 +
Change( Haystack  Position( Haystack  Needle  1  1 Length( 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:
+
   Making use of the constructed-in Case functionality (due to the fact there are only two circumstances, the If purpose could be applied listed here as very well), we examination for the existence of Needle within just Haystack with the constructed-in PatternCount operate:
  
PatternCount ( Haystack  Needle )&gt0  For the genuine situation, we print the effects of the constructed-in Substitute(textstartnumberOfCharactersreplacementText) perform.
+
PatternCount ( Haystack  Needle )&gt0  For the accurate case, we print the results of the developed-in Change(textstartnumberOfCharactersreplacementText) purpose.
  
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.
+
Substitute ( Haystack  Situation ( Haystack  Needle  one one )  Duration ( Needle )  Substitute )  The substitute in Haystack commences at the posture of the initial instance of Needle and extends the amount of people of Needle and is changed by Alternative.
  
For the false or default scenario, we only print Haystack given that there is no Needle to exchange.
+
For the wrong or default case, we only print Haystack given that there is no Needle to substitute.
  
  Global Search and Replace Purpose
+
  Worldwide Lookup and Substitute Perform
  
Operate Title: String Substitute
+
Function Name: String Swap
  
 
Parameters:
 
Parameters:
  
Needle - This parameter signifies the substring for which we want to search.
+
Needle - This parameter represents the substring for which we wish to lookup.
  
Substitute - This retains the string that will substitute the substring in Needle.
+
Substitute - This retains the string that will change 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.
+
Haystack - This parameter retains the whole string to look for: the proverbial Haystack in which to uncover and substitute the Needle, if you will.
  
Functionality Entire body:
+
Perform Human body:
  
 
If( PatternCount( Haystack  Needle ) &gt   
 
If( PatternCount( Haystack  Needle ) &gt   
  
Let( pos = Situation( Haystack  Needle  one  1 ) + Duration( Needle )  
+
Permit( pos = Placement( Haystack  Needle  one  one ) + Size( Needle )  
  
 
Permit(
 
Permit(
  
[  HaystackBegin = Situation( pos &gt  Remaining( Haystack  pos - one )  "" )  
+
[  HaystackBegin = Situation( pos &gt  Left( Haystack  pos - one )  "" )  
  
HaystackEnd = Center ( Haystack  pos  Size( Haystack ) - pos + 1 )
+
HaystackEnd = Center ( Haystack  pos  Length( Haystack ) - pos + 1 )
  
 
]
 
]
  
String Replace( Needle  Alternative HaystackBegin ) &amp String Replace All( Needle  Substitute  HaystackEnd )
+
String Replace( Needle  Substitute HaystackBegin ) &amp String Change All( Needle  Substitute  HaystackEnd )
  
 
)
 
)
Строка 45: Строка 53:
 
)
 
)
  
  Haystack)  Our foundation condition listed here is a Haystack with  situations of Needle. Right here we only output the Haystack.
+
  Haystack)  Our foundation problem listed here is a Haystack with  situations of Needle. Below we basically 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 condition, when Haystack has a lot more than  instances of Needle (it can never have a negative quantity of situations, of system), we replace the first instance and get in touch with this perform recursively with the remaining Haystack. With just about every call, there will be a single a lot less Needle in the Haystack, till the base condition is achieved the place  Needles exist in the Haystack.
  
pos = Situation( Haystack  Needle  one  one ) + Size( Needle ) - The character posture inside Haystack instantly next the very first occasion of Needle.
+
Employing the created-in If functionality, we do a examination for a non-base problem which is a Haystack with 1 or a lot more instance 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.
+
PatternCount( Haystack  Needle ) &gt  The explanation we really don't exam right for the base problem (i.e.PatternCount ( Haystack  Needle ) = ), is that in some situations, these as when Haystack is vacant, the PatternCount purpose may return an undefined price, which is neither  nor increased than , but really should result in a foundation affliction return.
  
 +
If the issue is accurate, there are Needles in the Haystack, so we established these variables:
  
  
[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]
+
pos = Place( Haystack  Needle  1  one ) + Size( Needle ) - The character situation inside of Haystack right away following the 1st occasion of Needle.
 +
HaystackBegin = Scenario( pos &gt  Left( Haystack pos - one )  "" ) - The material of the Haystack string up to posture pos. This string will include exactly one instance of Needle
 +
HaystackEnd = Center( Haystack  pos  Duration(Haystack) - pos + 1 ) - The remaining content of Haystack containing one particular considerably less instance of Needle. [http://en.netlog.com/gustafsonwalid/blog/blogid=21473521 filemaker], [http://canon-mcmillan.patch.com/events/hosting-f3de68e3 hosting], [http://sword-art-online.com/read_blog/81206/filemaker filemaker]

Текущая версия на 19:03, 13 апреля 2013

Needle - This parameter signifies the substring for which we wish to search.

Alternative - This holds the string that will replace the substring in Needle.

Haystack - This parameter holds the entire string to search: the proverbial Haystack in which to find and substitute the Needle, if you will.

Function Human body:

Scenario( PatternCount( Haystack Needle ) &gt

Change( Haystack  Position( Haystack  Needle  1  1 )  Length( Needle )  Substitute )
Haystack)
 Making use of the constructed-in Case functionality (due to the fact there are only two circumstances, the If purpose could be applied listed here as very well), we examination for the existence of Needle within just Haystack with the constructed-in PatternCount operate:

PatternCount ( Haystack Needle )&gt0 For the accurate case, we print the results of the developed-in Change(textstartnumberOfCharactersreplacementText) purpose.

Substitute ( Haystack Situation ( Haystack Needle one one ) Duration ( Needle ) Substitute ) The substitute in Haystack commences at the posture of the initial instance of Needle and extends the amount of people of Needle and is changed by Alternative.

For the wrong or default case, we only print Haystack given that there is no Needle to substitute.

Worldwide Lookup and Substitute Perform 

Function Name: String Swap

Parameters:

Needle - This parameter represents the substring for which we wish to lookup.

Substitute - This retains the string that will change the substring in Needle.

Haystack - This parameter retains the whole string to look for: the proverbial Haystack in which to uncover and substitute the Needle, if you will.

Perform Human body:

If( PatternCount( Haystack Needle ) &gt

Permit( pos = Placement( Haystack Needle one one ) + Size( Needle )

Permit(

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

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

]

String Replace( Needle Substitute HaystackBegin ) &amp String Change All( Needle Substitute HaystackEnd )

)

)

Haystack)   Our foundation problem listed here is a Haystack with  situations of Needle. Below we basically output the Haystack.

For a defining condition, when Haystack has a lot more than instances of Needle (it can never have a negative quantity of situations, of system), we replace the first instance and get in touch with this perform recursively with the remaining Haystack. With just about every call, there will be a single a lot less Needle in the Haystack, till the base condition is achieved the place Needles exist in the Haystack.

Employing the created-in If functionality, we do a examination for a non-base problem which is a Haystack with 1 or a lot more instance of Needle.

PatternCount( Haystack Needle ) &gt The explanation we really don't exam right for the base problem (i.e.PatternCount ( Haystack Needle ) = ), is that in some situations, these as when Haystack is vacant, the PatternCount purpose may return an undefined price, which is neither nor increased than , but really should result in a foundation affliction return.

If the issue is accurate, there are Needles in the Haystack, so we established these variables:


pos = Place( Haystack  Needle  1  one ) + Size( Needle ) - The character situation inside of Haystack right away following the 1st occasion of Needle.
HaystackBegin = Scenario( pos &gt   Left( Haystack pos - one )  "" ) - The material of the Haystack string up to posture pos. This string will include exactly one instance of Needle 
HaystackEnd = Center( Haystack  pos  Duration(Haystack) - pos + 1 ) - The remaining content of Haystack containing one particular considerably less instance of Needle. filemaker, hosting, filemaker