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...)
 
 
(не показано 5 промежуточных версий этого же участника)
Строка 1: Строка 1:
Needle - This parameter represents the substring for which we desire to research.
+
Needle - This parameter signifies the substring for which we wish to search.
  
Alternative - This retains the string that will substitute the substring in Needle.
+
Alternative - This holds the string that will replace the substring in Needle.
  
Haystack - This parameter holds the complete string to search: the proverbial Haystack in which to discover and change the Needle, if you will.
+
Haystack - This parameter holds the entire string to search: the proverbial Haystack in which to find and substitute the Needle, if you will.
  
Operate Human body:
+
Function Human body:
  
 
Scenario( PatternCount( Haystack  Needle ) &gt  
 
Scenario( PatternCount( Haystack  Needle ) &gt  
  
  Substitute( Haystack  Posture( Haystack  Needle  1  1 )  Duration( Needle )  Substitute )
+
  Change( Haystack  Position( Haystack  Needle  1  1 )  Length( 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:
+
   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 scenario, we print the outcomes of the developed-in Swap(textstartnumberOfCharactersreplacementText) operate.
+
PatternCount ( Haystack  Needle )&gt0  For the accurate case, we print the results of the developed-in Change(textstartnumberOfCharactersreplacementText) purpose.
  
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.
+
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 fake or default case, we simply print Haystack considering that there is no Needle to replace.
+
For the wrong or default case, we only print Haystack given that there is no Needle to substitute.
  
  International Lookup and Replace Purpose
+
  Worldwide Lookup and Substitute Perform
  
Functionality Identify: String Swap
+
Function Name: String Swap
  
 
Parameters:
 
Parameters:
  
Needle - This parameter represents the substring for which we want to research.
+
Needle - This parameter represents the substring for which we wish to lookup.
  
Alternative - This holds the string that will substitute the substring in Needle.
+
Substitute - This retains the string that will change 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 retains the whole string to look for: the proverbial Haystack in which to uncover and substitute the Needle, if you will.
  
 
Perform Human body:
 
Perform Human body:
Строка 37: Строка 37:
 
If( PatternCount( Haystack  Needle ) &gt   
 
If( PatternCount( Haystack  Needle ) &gt   
  
Allow( pos = Position( Haystack  Needle  one  one ) + Length( Needle )  
+
Permit( pos = Placement( Haystack  Needle  one  one ) + Size( Needle )  
  
Enable(
+
Permit(
  
[  HaystackBegin = Circumstance( pos &gt  Left( Haystack  pos - 1 )  "" )  
+
[  HaystackBegin = Situation( pos &gt  Left( Haystack  pos - one )  "" )  
  
 
HaystackEnd = Center ( Haystack  pos  Length( Haystack ) - pos + 1 )
 
HaystackEnd = Center ( Haystack  pos  Length( Haystack ) - pos + 1 )
Строка 47: Строка 47:
 
]
 
]
  
String Substitute( Needle  Replacement HaystackBegin ) &amp String Replace All( Needle  Substitute  HaystackEnd )
+
String Replace( Needle  Substitute HaystackBegin ) &amp String Change All( Needle  Substitute  HaystackEnd )
  
 
)
 
)
Строка 53: Строка 53:
 
)
 
)
  
  Haystack)  Our foundation situation in this article is a Haystack with  circumstances of Needle. Below we merely 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 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.
+
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.
  
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.
+
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 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.
+
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 affliction is accurate, there are Needles in the Haystack, so we set these variables:
+
If the issue is accurate, there are Needles in the Haystack, so we established these variables:
  
  
  pos = Position( Haystack  Needle  1  one ) + Duration( Needle ) - The character place inside of Haystack quickly subsequent the 1st instance of Needle.
+
  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 - 1 )  "" ) - The content of the Haystack string up to position pos. This string will consist of precisely 1 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 = 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]
+
  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